Mako 8.3.0 API
MakoCore SDK API Documentation
Loading...
Searching...
No Matches
pdfinput.h
Go to the documentation of this file.
1/*
2* Copyright (C) 2008-2025 Global Graphics Software Ltd. All rights reserved.
3*/
4
5#ifndef JAWSMAKO_PDFINPUT_H
6#define JAWSMAKO_PDFINPUT_H
7
17
18#include <jawsmako/jawsmako.h>
19#include <edl/idomfont.h>
21
22namespace JawsMako
23{
24 using namespace EDL;
25
26 class IPDFInput;
28
34 class IPDFInput : public IInput
35 {
36 public:
37 virtual ~IPDFInput() = default;
38
47 static JAWSMAKO_API IPDFInputPtr create(const IJawsMakoPtr &jawsMako, const IProgressMonitorPtr &progressMonitor = IProgressMonitorPtr ());
48
57 virtual void setPassword(const U8String &password) = 0;
58
69 virtual void setPkcs12(const IRAInputStreamPtr &pkcs12) = 0;
70
88 virtual void setFailOnFontFallback(bool failOnFontFallback) = 0;
89
118
126
145 virtual void setIgnoreNonGraphicalObjects(bool ignoreNonGraphical) = 0;
146
152 {
153 public:
155 {
156 embedded = false;
157 subset = false;
158 objectNumber = -1;
159 generation = -1;
162 }
163
164 bool embedded;
165 bool subset;
169
172
175
177
178 IDOMFontPtr font;
180
182 //
183 // Simple fonts:
184 // - The Encoding name for fonts that define an encoding with no Differences,
185 // which may be "MacRomanEncoding", "MacExpertEncoding", or "WinAnsiEncoding".
186 // - "Custom" for fonts that define an Encoding dictionary with Differences.
187 // - "StandardEncoding" for non-symbolic fonts that do not define an Encoding.
188 // - "Built-in" for symbolic fonts that do not define an Encoding.
189 // Composite fonts:
190 // - The name of the CMap from the Type 0 font dictionary Encoding for fonts
191 // that define a predefined CMap.
192 // - "Custom" for fonts that define a CMap stream as the Type 0 font dictionary
193 // Encoding.
194
195 bool operator== (const CPdfFontInfo &other) const
196 {
197 return (other.embedded == embedded)
198 && (other.subset == subset)
199 && (other.fontType == fontType)
200 && (other.fontName == fontName)
201 && (other.baseFontName == baseFontName)
202 && (other.encoding == encoding)
203 && (other.objectNumber == objectNumber)
204 && (other.generation == generation)
207 && (other.font == font);
208 }
209
210 bool operator!= (const CPdfFontInfo &other) const
211 {
212 return ! (*this == other);
213 }
214 };
215
217
246 virtual CPdfFontInfoVect scanPdfForFonts(const U8String &pathToFile, const IProgressMonitorPtr &progressMonitor, bool domFont = false) = 0;
247
276 virtual CPdfFontInfoVect scanPdfForFonts(const String &pathToFile, const IProgressMonitorPtr &progressMonitor, bool domFont = false) = 0;
277
306 virtual CPdfFontInfoVect scanPdfForFonts(const IInputStreamPtr &pdfStream, const IProgressMonitorPtr &progressMonitor, bool domFont = false) = 0;
307
308
318 {
319 public:
323
324 bool operator== (const CPdfScannedInk &other) const
325 {
326 return (other.inkName == inkName)
327 && (other.pageNums == pageNums);
328 }
329
330 bool operator!= (const CPdfScannedInk &other) const
331 {
332 return ! (*this == other);
333 }
334
336 {
337 return inkNameToString(inkName);
338 }
339
340 String getInkName(eInkFallbackEncoding fallbackEncoding) const
341 {
342 return inkNameToString(inkName, fallbackEncoding);
343 }
344 };
345
347
361 virtual CPdfScannedInkVect scanPdfForInks(const U8String &pathToFile,
362 const IProgressMonitorPtr &progressMonitor,
363 uint32 startPageIndex = 0,
364 uint32 endPageIndex = 0,
365 bool includeAll = false) = 0;
366
380 virtual CPdfScannedInkVect scanPdfForInks(const String &pathToFile,
381 const IProgressMonitorPtr &progressMonitor,
382 uint32 startPageIndex = 0,
383 uint32 endPageIndex = 0,
384 bool includeAll = false) = 0;
385
398 virtual CPdfScannedInkVect scanPdfForInks(const IInputStreamPtr &pdfStream,
399 const IProgressMonitorPtr &progressMonitor,
400 uint32 startPageIndex = 0,
401 uint32 endPageIndex = 0,
402 bool includeAll = false) = 0;
403
411 virtual uint32 getNumIncrementalSaves(const U8String &pathToFile) = 0;
412
420 virtual uint32 getNumIncrementalSaves(const String &pathToFile) = 0;
421
430 virtual uint32 getNumIncrementalSaves(const IInputStreamPtr &pdfStream) = 0;
431
439 virtual IDocumentAssemblyPtr openIncremental(const U8String &pathToFile, uint32 incrementalIndex) = 0;
440
448 virtual IDocumentAssemblyPtr openIncremental(const String &pathToFile, uint32 incrementalIndex) = 0;
449
457 virtual IDocumentAssemblyPtr openIncremental(const IInputStreamPtr &pdfStream, uint32 incrementalIndex) = 0;
458
468 virtual CIRAInputStreamVect getIncrementalSaves(const U8String &pathToFile) = 0;
469
479 virtual CIRAInputStreamVect getIncrementalSaves(const String &pathToFile) = 0;
480
490 virtual CIRAInputStreamVect getIncrementalSaves(const IInputStreamPtr &pdfStream) = 0;
491
507 virtual void setAlternateBaseFont(const U8String &baseFontName, const U8String &alternateFontName) = 0;
508 };
509 #define obj2IPDFInput(obj) IPDFInputPtr(dynamic_cast<IPDFInput *>((IRCObject *) (obj)), true)
510}
511
512#endif
Definition edlvector.h:30
Abstract input source that can open files from disk or a stream and create an IDocumentAssembly for t...
Definition jawsmako.h:466
int32 subFontObjectNumber
If the font dictionary is a CIDFont and the subfont is an indirect object, this is the object number ...
Definition pdfinput.h:173
int32 subFontGeneration
If the font dictionary is a CIDFont and the subfont is an indirect object, this is the object number ...
Definition pdfinput.h:174
RawString fontType
The PDF Font Type as a string.
Definition pdfinput.h:166
IDOMFontPtr font
Definition pdfinput.h:178
RawString baseFontName
The "base" (PostScript) name of the font according to the Font dictionary.
Definition pdfinput.h:168
RawString encoding
The Encoding type, which is set according to the font type as follows:
Definition pdfinput.h:181
CUInt32Vect referencedPages
A vector of 0-indexed page numbers on which this font is referenced.
Definition pdfinput.h:176
int32 generation
If the font dictionary is an indirect object, this is the generation (negative otherwise).
Definition pdfinput.h:171
bool embedded
True if the PDF provides an embedded font stream for this font.
Definition pdfinput.h:164
CPdfFontInfo()
Definition pdfinput.h:154
RawString fontName
The name of the font, according to the font's FontDescriptor entry, if present.
Definition pdfinput.h:167
int32 objectNumber
If the font dictionary is an indirect object, this is the object number (negative otherwise).
Definition pdfinput.h:170
bool operator==(const CPdfFontInfo &other) const
Definition pdfinput.h:195
bool operator!=(const CPdfFontInfo &other) const
Definition pdfinput.h:210
bool subset
True if the PDF indicates the font is a subset (that is, the font name has a subset tag).
Definition pdfinput.h:165
Basic information about an ink used in a PDF file, obtained by scanning the PDF page tree.
Definition pdfinput.h:318
bool operator!=(const CPdfScannedInk &other) const
Definition pdfinput.h:330
String getInkName() const
Definition pdfinput.h:335
String getInkName(eInkFallbackEncoding fallbackEncoding) const
Definition pdfinput.h:340
RawString inkName
The name of the ink.
Definition pdfinput.h:320
bool operator==(const CPdfScannedInk &other) const
Definition pdfinput.h:324
CUInt32Vect pageNums
Definition pdfinput.h:321
An instance of the JawsMako PDF input class.
Definition pdfinput.h:35
virtual CPdfScannedInkVect scanPdfForInks(const String &pathToFile, const IProgressMonitorPtr &progressMonitor, uint32 startPageIndex=0, uint32 endPageIndex=0, bool includeAll=false)=0
Quickly scan the PDF file at the given wide character path and find any mentions of inks in color spa...
virtual IDocumentAssemblyPtr openIncremental(const IInputStreamPtr &pdfStream, uint32 incrementalIndex)=0
Open an incremental PDF stream, returning the IDocumentAssembly representing the contents.
virtual uint32 getNumIncrementalSaves(const String &pathToFile)=0
Find the number of incremental saves in the given PDF stream.
virtual CPdfScannedInkVect scanPdfForInks(const IInputStreamPtr &pdfStream, const IProgressMonitorPtr &progressMonitor, uint32 startPageIndex=0, uint32 endPageIndex=0, bool includeAll=false)=0
Quickly scan the given PDF stream and find any mentions of inks in color spaces.
virtual uint32 getNumIncrementalSaves(const IInputStreamPtr &pdfStream)=0
Find the number of incremental saves in the given PDF stream.
virtual void setIgnoreNonGraphicalObjects(bool ignoreNonGraphical)=0
Optionally ignore non-graphical PDF objects when reading the PDF.
CEDLVector< CPdfScannedInk > CPdfScannedInkVect
Definition pdfinput.h:346
virtual void setAlternateBaseFont(const U8String &baseFontName, const U8String &alternateFontName)=0
Set an alternate base font for cases when the built-in font may not be suitable.
virtual uint32 getNumIncrementalSaves(const U8String &pathToFile)=0
Find the number of incremental saves in the given PDF stream.
virtual IDocumentAssemblyPtr openIncremental(const String &pathToFile, uint32 incrementalIndex)=0
Open an incremental PDF stream, returning the IDocumentAssembly representing the contents.
virtual CIRAInputStreamVect getIncrementalSaves(const String &pathToFile)=0
Find the number of incremental saves in the given PDF stream, returning a vector of streams.
virtual CPdfFontInfoVect scanPdfForFonts(const IInputStreamPtr &pdfStream, const IProgressMonitorPtr &progressMonitor, bool domFont=false)=0
Quickly scan the PDF file in the given stream for fonts. Does not attempt to validate the fonts,...
virtual IDocumentAssemblyPtr openIncremental(const U8String &pathToFile, uint32 incrementalIndex)=0
Open an incremental PDF stream, returning the IDocumentAssembly representing the contents.
virtual ~IPDFInput()=default
static JAWSMAKO_API IPDFInputPtr create(const IJawsMakoPtr &jawsMako, const IProgressMonitorPtr &progressMonitor=IProgressMonitorPtr())
Create an input for reading source documents in PDF format.
virtual CPdfFontInfoVect scanPdfForFonts(const U8String &pathToFile, const IProgressMonitorPtr &progressMonitor, bool domFont=false)=0
Quickly scan the PDF file at the given UTF-8 path for fonts. Does not attempt to validate the fonts,...
CEDLVector< CPdfFontInfo > CPdfFontInfoVect
Definition pdfinput.h:216
virtual CPdfScannedInkVect scanPdfForInks(const U8String &pathToFile, const IProgressMonitorPtr &progressMonitor, uint32 startPageIndex=0, uint32 endPageIndex=0, bool includeAll=false)=0
Quickly scan the PDF file at the given UTF-8 path and find any mentions of inks in color spaces.
virtual void setFailOnFontFallback(bool failOnFontFallback)=0
Set whether to fail when a font cannot be found and PDF input needs to use a fallback font or create ...
virtual void setImproveGlyphSelectionForUnembeddedIdentityFonts(bool improve)=0
Set whether to attempt to improve glyph selection for unembedded Identity CIDFonts.
virtual void setPkcs12(const IRAInputStreamPtr &pkcs12)=0
Set the stream containing the PKCS12/PFX data containing the private key used to decrypt the PDF when...
virtual CPdfFontInfoVect scanPdfForFonts(const String &pathToFile, const IProgressMonitorPtr &progressMonitor, bool domFont=false)=0
Quickly scan the PDF file at the given wide-character Unicode path for fonts. Does not attempt to val...
virtual void setDefaultRenderingIntent(eRenderingIntent intent)=0
Override the default rendering intent in the PDF.
virtual void setPassword(const U8String &password)=0
Set the password that should be used when attempting to open PDF files. For password encrypted PDF,...
virtual CIRAInputStreamVect getIncrementalSaves(const U8String &pathToFile)=0
Find the number of incremental saves in the given PDF stream, returning a vector of streams.
virtual CIRAInputStreamVect getIncrementalSaves(const IInputStreamPtr &pdfStream)=0
Find the number of incremental saves in the given PDF stream, returning a vector of streams.
CEDLVector< IRAInputStreamPtr > CIRAInputStreamVect
Definition edlstream.h:92
unsigned int uint32
Definition edltypes.h:34
signed int int32
Definition edltypes.h:29
eRenderingIntent
Rendering intent enumeration.
Definition edlrenderingintent.h:17
EDLSysString U8String
A UTF-8 String.
Definition types.h:144
EDLSysString RawString
A raw, 8 bit string. Encoding depends on context.
Definition types.h:150
EDLString String
A wide character string (UTF-16 on Windows, UTF-32 on all other platforms)
Definition types.h:138
Definition apexcustompostprocess.h:17
CEDLVector< uint32 > CUInt32Vect
Definition types.h:178
EDL::IProgressMonitorPtr IProgressMonitorPtr
Definition types.h:85
JAWSMAKO_API String inkNameToString(const RawString &string)
Convert string used for ink name to String (wide char)
eInkFallbackEncoding
An enumeration of fallback encoding schemes to use for decoding PDF ink names that are not presented ...
Definition types.h:312
#define DECL_SMART_PTR(cls)
Definition smartptr.h:211
#define JAWSMAKO_API
Definition types.h:29