Mako 8.2.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() {}
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
132 {
133 public:
135 {
136 embedded = false;
137 subset = false;
138 objectNumber = -1;
139 generation = -1;
142 }
143
144 bool embedded;
145 bool subset;
149
152
155
157
158 IDOMFontPtr font;
160
162 //
163 // Simple fonts:
164 // - The Encoding name for fonts that define an encoding with no Differences,
165 // which may be "MacRomanEncoding", "MacExpertEncoding", or "WinAnsiEncoding".
166 // - "Custom" for fonts that define an Encoding dictionary with Differences.
167 // - "StandardEncoding" for non-symbolic fonts that do not define an Encoding.
168 // - "Built-in" for symbolic fonts that do not define an Encoding.
169 // Composite fonts:
170 // - The name of the CMap from the Type 0 font dictionary Encoding for fonts
171 // that define a predefined CMap.
172 // - "Custom" for fonts that define a CMap stream as the Type 0 font dictionary
173 // Encoding.
174
175 bool operator== (const CPdfFontInfo &other) const
176 {
177 return (other.embedded == embedded)
178 && (other.subset == subset)
179 && (other.fontType == fontType)
180 && (other.fontName == fontName)
181 && (other.baseFontName == baseFontName)
182 && (other.encoding == encoding)
183 && (other.objectNumber == objectNumber)
184 && (other.generation == generation)
187 && (other.font == font);
188 }
189
190 bool operator!= (const CPdfFontInfo &other) const
191 {
192 return ! (*this == other);
193 }
194 };
195
197
219 virtual CPdfFontInfoVect scanPdfForFonts(const U8String &pathToFile, const IProgressMonitorPtr &progressMonitor, bool domFont = false) = 0;
220
242 virtual CPdfFontInfoVect scanPdfForFonts(const String &pathToFile, const IProgressMonitorPtr &progressMonitor, bool domFont = false) = 0;
243
265 virtual CPdfFontInfoVect scanPdfForFonts(const IInputStreamPtr &pdfStream, const IProgressMonitorPtr &progressMonitor, bool domFont = false) = 0;
266
267
277 {
278 public:
282
283 bool operator== (const CPdfScannedInk &other) const
284 {
285 return (other.inkName == inkName)
286 && (other.pageNums == pageNums);
287 }
288
289 bool operator!= (const CPdfScannedInk &other) const
290 {
291 return ! (*this == other);
292 }
293
295 {
296 return inkNameToString(inkName);
297 }
298
299 String getInkName(eInkFallbackEncoding fallbackEncoding) const
300 {
301 return inkNameToString(inkName, fallbackEncoding);
302 }
303 };
304
306
319 virtual CPdfScannedInkVect scanPdfForInks(const U8String &pathToFile, const IProgressMonitorPtr &progressMonitor, uint32 startPageIndex = 0, uint32 endPageIndex = 0) = 0;
320
333 virtual CPdfScannedInkVect scanPdfForInks(const String &pathToFile, const IProgressMonitorPtr &progressMonitor, uint32 startPageIndex = 0, uint32 endPageIndex = 0) = 0;
334
346 virtual CPdfScannedInkVect scanPdfForInks(const IInputStreamPtr &pdfStream, const IProgressMonitorPtr &progressMonitor, uint32 startPageIndex = 0, uint32 endPageIndex = 0) = 0;
347
355 virtual uint32 getNumIncrementalSaves(const U8String &pathToFile) = 0;
356
364 virtual uint32 getNumIncrementalSaves(const String &pathToFile) = 0;
365
374 virtual uint32 getNumIncrementalSaves(const IInputStreamPtr &pdfStream) = 0;
375
383 virtual IDocumentAssemblyPtr openIncremental(const U8String &pathToFile, uint32 incrementalIndex) = 0;
384
392 virtual IDocumentAssemblyPtr openIncremental(const String &pathToFile, uint32 incrementalIndex) = 0;
393
401 virtual IDocumentAssemblyPtr openIncremental(const IInputStreamPtr &pdfStream, uint32 incrementalIndex) = 0;
402
412 virtual CIRAInputStreamVect getIncrementalSaves(const U8String &pathToFile) = 0;
413
423 virtual CIRAInputStreamVect getIncrementalSaves(const String &pathToFile) = 0;
424
434 virtual CIRAInputStreamVect getIncrementalSaves(const IInputStreamPtr &pdfStream) = 0;
435
451 virtual void setAlternateBaseFont(const U8String &baseFontName, const U8String &alternateFontName) = 0;
452 };
453 #define obj2IPDFInput(obj) IPDFInputPtr(dynamic_cast<IPDFInput *>((IRCObject *) (obj)), true)
454}
455
456#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:153
int32 subFontGeneration
If the font dictionary is a CIDFont and the subfont is an indirect object, this is the object number ...
Definition pdfinput.h:154
RawString fontType
The PDF Font Type as a string.
Definition pdfinput.h:146
IDOMFontPtr font
Definition pdfinput.h:158
RawString baseFontName
The "base" (PostScript) name of the font according to the Font dictionary.
Definition pdfinput.h:148
RawString encoding
The Encoding type, which is set according to the font type as follows:
Definition pdfinput.h:161
CUInt32Vect referencedPages
A vector of 0-indexed page numbers on which this font is referenced.
Definition pdfinput.h:156
int32 generation
If the font dictionary is an indirect object, this is the generation (negative otherwise).
Definition pdfinput.h:151
bool embedded
True if the PDF provides an embedded font stream for this font.
Definition pdfinput.h:144
CPdfFontInfo()
Definition pdfinput.h:134
RawString fontName
The name of the font, according to the font's FontDescriptor entry, if present.
Definition pdfinput.h:147
int32 objectNumber
If the font dictionary is an indirect object, this is the object number (negative otherwise).
Definition pdfinput.h:150
bool operator==(const CPdfFontInfo &other) const
Definition pdfinput.h:175
bool operator!=(const CPdfFontInfo &other) const
Definition pdfinput.h:190
bool subset
True if the PDF indicates the font is a subset (that is, the font name has a subset tag).
Definition pdfinput.h:145
Basic information about an ink used in a PDF file, obtained by scanning the PDF page tree.
Definition pdfinput.h:277
bool operator!=(const CPdfScannedInk &other) const
Definition pdfinput.h:289
String getInkName() const
Definition pdfinput.h:294
String getInkName(eInkFallbackEncoding fallbackEncoding) const
Definition pdfinput.h:299
RawString inkName
The name of the ink.
Definition pdfinput.h:279
bool operator==(const CPdfScannedInk &other) const
Definition pdfinput.h:283
CUInt32Vect pageNums
Definition pdfinput.h:280
An instance of the JawsMako PDF input class.
Definition pdfinput.h:35
virtual IDocumentAssemblyPtr openIncremental(const IInputStreamPtr &pdfStream, uint32 incrementalIndex)=0
Open an incremental PDF stream, returning the IDocumentAssembly representing the contents.
virtual CPdfScannedInkVect scanPdfForInks(const U8String &pathToFile, const IProgressMonitorPtr &progressMonitor, uint32 startPageIndex=0, uint32 endPageIndex=0)=0
Quickly scan the PDF file at the given UTF-8 path and find any mentions of inks in color spaces.
virtual uint32 getNumIncrementalSaves(const String &pathToFile)=0
Find the number of incremental saves in the given PDF stream.
virtual uint32 getNumIncrementalSaves(const IInputStreamPtr &pdfStream)=0
Find the number of incremental saves in the given PDF stream.
CEDLVector< CPdfScannedInk > CPdfScannedInkVect
Definition pdfinput.h:305
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 CPdfScannedInkVect scanPdfForInks(const IInputStreamPtr &pdfStream, const IProgressMonitorPtr &progressMonitor, uint32 startPageIndex=0, uint32 endPageIndex=0)=0
Quickly scan the given PDF stream and find any mentions of inks in color spaces.
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:196
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 CPdfScannedInkVect scanPdfForInks(const String &pathToFile, const IProgressMonitorPtr &progressMonitor, uint32 startPageIndex=0, uint32 endPageIndex=0)=0
Quickly scan the PDF file at the given wide character path and find any mentions of inks in color spa...
virtual void setImproveGlyphSelectionForUnembeddedIdentityFonts(bool improve)=0
Set whether to attempt to improve glyph selection for unembedded Identity CIDFonts.
virtual ~IPDFInput()
Definition pdfinput.h:37
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