mirror of
https://github.com/qpdf/qpdf.git
synced 2024-12-22 02:49:00 +00:00
Fix doc typos
This commit is contained in:
parent
3c5700c255
commit
acd0acf169
@ -14,3 +14,4 @@ d740c6ccced02147f84a39d5e5f0984d12bac6cb
|
|||||||
60965d5f4d608bdccc2ffd4e8753e12cbbbd71d2
|
60965d5f4d608bdccc2ffd4e8753e12cbbbd71d2
|
||||||
# Reflow comments and strings to 100 columns
|
# Reflow comments and strings to 100 columns
|
||||||
698a70e6a84cf7c0db667e9d9e021b4c34c85a3e
|
698a70e6a84cf7c0db667e9d9e021b4c34c85a3e
|
||||||
|
3c5700c255f4603b5df9c6d183d13dd71a083cc3
|
||||||
|
@ -120,9 +120,9 @@ main(int argc, char* argv[])
|
|||||||
QPDFObjectHandle color_space = image_dict.getKey("/ColorSpace");
|
QPDFObjectHandle color_space = image_dict.getKey("/ColorSpace");
|
||||||
QPDFObjectHandle bits_per_component = image_dict.getKey("/BitsPerComponent");
|
QPDFObjectHandle bits_per_component = image_dict.getKey("/BitsPerComponent");
|
||||||
|
|
||||||
// For our example, we can only work with images 8-bit grayscale images that we can
|
// For our example, we can only work with 8-bit grayscale images that we can fully
|
||||||
// fully decode. Use pipeStreamData with a null pipeline to determine whether the
|
// decode. Use pipeStreamData with a null pipeline to determine whether the image
|
||||||
// image is filterable. Directly inspect keys to determine the image type.
|
// is filterable. Directly inspect keys to determine the image type.
|
||||||
if (image.pipeStreamData(nullptr, qpdf_ef_compress, qpdf_dl_all) &&
|
if (image.pipeStreamData(nullptr, qpdf_ef_compress, qpdf_dl_all) &&
|
||||||
color_space.isNameAndEquals("/DeviceGray") && bits_per_component.isInteger() &&
|
color_space.isNameAndEquals("/DeviceGray") && bits_per_component.isInteger() &&
|
||||||
(bits_per_component.getIntValue() == 8)) {
|
(bits_per_component.getIntValue() == 8)) {
|
||||||
|
@ -41,7 +41,7 @@ main(int argc, char* argv[])
|
|||||||
// (root), and write an empty PDF to a file. The PDF will have no pages and won't be viewable,
|
// (root), and write an empty PDF to a file. The PDF will have no pages and won't be viewable,
|
||||||
// but you can look at it in a text editor to see the resulting structure of the PDF.
|
// but you can look at it in a text editor to see the resulting structure of the PDF.
|
||||||
|
|
||||||
// Create a dictionary off the root where we will hang our name and number tree.
|
// Create a dictionary off the root where we will hang our name and number trees.
|
||||||
auto root = qpdf.getRoot();
|
auto root = qpdf.getRoot();
|
||||||
auto example = QPDFObjectHandle::newDictionary();
|
auto example = QPDFObjectHandle::newDictionary();
|
||||||
root.replaceKey("/Example", example);
|
root.replaceKey("/Example", example);
|
||||||
|
@ -38,7 +38,7 @@ main(int argc, char* argv[])
|
|||||||
qpdf.processFile(infilename);
|
qpdf.processFile(infilename);
|
||||||
|
|
||||||
// We will iterate through form fields by starting at the page level and looking at each
|
// We will iterate through form fields by starting at the page level and looking at each
|
||||||
// field for each page. We could also called QPDFAcroFormDocumentHelper::getFormFields to
|
// field for each page. We could also call QPDFAcroFormDocumentHelper::getFormFields to
|
||||||
// iterate at the field level, but doing it as below illustrates how we can map from
|
// iterate at the field level, but doing it as below illustrates how we can map from
|
||||||
// annotations to fields.
|
// annotations to fields.
|
||||||
|
|
||||||
@ -51,12 +51,12 @@ main(int argc, char* argv[])
|
|||||||
// value.
|
// value.
|
||||||
QPDFFormFieldObjectHelper ffh = afdh.getFieldForAnnotation(annot);
|
QPDFFormFieldObjectHelper ffh = afdh.getFieldForAnnotation(annot);
|
||||||
if (ffh.getFieldType() == "/Tx") {
|
if (ffh.getFieldType() == "/Tx") {
|
||||||
// Set the value. Passing false as the second value prevents qpdf from setting
|
// Set the value. Passing false as the second parameter prevents qpdf from
|
||||||
// /NeedAppearances to true (but will not turn it off if it's already on), so we
|
// setting /NeedAppearances to true (but will not turn it off if it's already
|
||||||
// call generateAppearance after setting the value. You may or may not want to
|
// on), so we call generateAppearance after setting the value. You may or may
|
||||||
// do this depending on whether the appearance streams generated by qpdf are
|
// not want to do this depending on whether the appearance streams generated by
|
||||||
// good enough for your purposes. For additional details, please see comments in
|
// qpdf are good enough for your purposes. For additional details, please see
|
||||||
// QPDFFormFieldObjectHelper.hh for this method.
|
// comments in QPDFFormFieldObjectHelper.hh for this method.
|
||||||
ffh.setV(value, false);
|
ffh.setV(value, false);
|
||||||
ffh.generateAppearance(annot);
|
ffh.generateAppearance(annot);
|
||||||
}
|
}
|
||||||
|
@ -20,9 +20,9 @@
|
|||||||
#define QPDF_CLOSEDFILEINPUTSOURCE_HH
|
#define QPDF_CLOSEDFILEINPUTSOURCE_HH
|
||||||
|
|
||||||
// This is an input source that reads from files, like FileInputSource, except that it opens and
|
// This is an input source that reads from files, like FileInputSource, except that it opens and
|
||||||
// close the file surrounding every operation. This decreases efficiency, but it allows many more of
|
// closes the file surrounding every operation. This decreases efficiency, but it allows many more
|
||||||
// these to exist at once than the maximum number of open file descriptors. This is used for merging
|
// of these to exist at once than the maximum number of open file descriptors. This is used for
|
||||||
// large numbers of files.
|
// merging large numbers of files.
|
||||||
|
|
||||||
#include <qpdf/InputSource.hh>
|
#include <qpdf/InputSource.hh>
|
||||||
#include <qpdf/PointerHolder.hh> // unused -- remove in qpdf 12 (see #785)
|
#include <qpdf/PointerHolder.hh> // unused -- remove in qpdf 12 (see #785)
|
||||||
|
@ -69,7 +69,7 @@ class JSON
|
|||||||
// to pass that `first` through to all the methods that are called to add top-level items to the
|
// to pass that `first` through to all the methods that are called to add top-level items to the
|
||||||
// container as well as to close the container. This lets the JSON object use it to keep track
|
// container as well as to close the container. This lets the JSON object use it to keep track
|
||||||
// of when it's writing a first object and when it's not. If incrementally writing multiple
|
// of when it's writing a first object and when it's not. If incrementally writing multiple
|
||||||
// levels of depth, a new `first` should used for each new container that is opened.
|
// levels of depth, a new `first` should be used for each new container that is opened.
|
||||||
//
|
//
|
||||||
// "depth" -- Indicate the level of depth. This is used for consistent indentation. When writing
|
// "depth" -- Indicate the level of depth. This is used for consistent indentation. When writing
|
||||||
// incrementally, whenever you call a method to add an item to a container, the value of `depth`
|
// incrementally, whenever you call a method to add an item to a container, the value of `depth`
|
||||||
@ -208,7 +208,7 @@ class JSON
|
|||||||
QPDF_DLL
|
QPDF_DLL
|
||||||
bool checkSchema(JSON schema, std::list<std::string>& errors);
|
bool checkSchema(JSON schema, std::list<std::string>& errors);
|
||||||
|
|
||||||
// An pointer to a Reactor class can be passed to parse, which will enable the caller to react
|
// A pointer to a Reactor class can be passed to parse, which will enable the caller to react
|
||||||
// to incremental events in the construction of the JSON object. This makes it possible to
|
// to incremental events in the construction of the JSON object. This makes it possible to
|
||||||
// implement SAX-like handling of very large JSON objects.
|
// implement SAX-like handling of very large JSON objects.
|
||||||
class QPDF_DLL_CLASS Reactor
|
class QPDF_DLL_CLASS Reactor
|
||||||
|
@ -16,9 +16,6 @@
|
|||||||
// License. At your option, you may continue to consider qpdf to be licensed under those terms.
|
// License. At your option, you may continue to consider qpdf to be licensed under those terms.
|
||||||
// Please see the manual for additional information.
|
// Please see the manual for additional information.
|
||||||
|
|
||||||
// This class implements a simple writer for saving QPDF objects to new PDF files. See comments
|
|
||||||
// through the header file for additional details.
|
|
||||||
|
|
||||||
#ifndef PDFVERSION_HH
|
#ifndef PDFVERSION_HH
|
||||||
#define PDFVERSION_HH
|
#define PDFVERSION_HH
|
||||||
|
|
||||||
|
@ -19,7 +19,7 @@
|
|||||||
#ifndef PL_CONCATENATE_HH
|
#ifndef PL_CONCATENATE_HH
|
||||||
#define PL_CONCATENATE_HH
|
#define PL_CONCATENATE_HH
|
||||||
|
|
||||||
// This pipeline will drop all regular finished calls rather than passing them onto next. To finish
|
// This pipeline will drop all regular finish calls rather than passing them onto next. To finish
|
||||||
// downstream streams, call manualFinish. This makes it possible to pipe multiple streams (e.g.
|
// downstream streams, call manualFinish. This makes it possible to pipe multiple streams (e.g.
|
||||||
// with QPDFObjectHandle::pipeStreamData) to a downstream like Pl_Flate that can't handle multiple
|
// with QPDFObjectHandle::pipeStreamData) to a downstream like Pl_Flate that can't handle multiple
|
||||||
// calls to finish().
|
// calls to finish().
|
||||||
|
@ -40,7 +40,7 @@ class QPDFAnnotationObjectHelper: public QPDFObjectHelper
|
|||||||
// besides widget annotations, but they are implemented with form fields so that they can
|
// besides widget annotations, but they are implemented with form fields so that they can
|
||||||
// properly handle form fields when needed.
|
// properly handle form fields when needed.
|
||||||
|
|
||||||
// Return the subtype of the annotation as a string (e.g. "/Widget"). Returns the empty string
|
// Return the subtype of the annotation as a string (e.g. "/Widget"). Returns an empty string
|
||||||
// if the subtype (which is required by the spec) is missing.
|
// if the subtype (which is required by the spec) is missing.
|
||||||
QPDF_DLL
|
QPDF_DLL
|
||||||
std::string getSubtype();
|
std::string getSubtype();
|
||||||
@ -51,7 +51,7 @@ class QPDFAnnotationObjectHelper: public QPDFObjectHelper
|
|||||||
QPDF_DLL
|
QPDF_DLL
|
||||||
QPDFObjectHandle getAppearanceDictionary();
|
QPDFObjectHandle getAppearanceDictionary();
|
||||||
|
|
||||||
// Return the appearance state as given in "/AS", or the empty string if none is given.
|
// Return the appearance state as given in "/AS", or an empty string if none is given.
|
||||||
QPDF_DLL
|
QPDF_DLL
|
||||||
std::string getAppearanceState();
|
std::string getAppearanceState();
|
||||||
|
|
||||||
|
@ -23,12 +23,12 @@
|
|||||||
#include <qpdf/QPDF.hh>
|
#include <qpdf/QPDF.hh>
|
||||||
|
|
||||||
// This is a base class for QPDF Document Helper classes. Document helpers are classes that provide
|
// This is a base class for QPDF Document Helper classes. Document helpers are classes that provide
|
||||||
// a convenient, higher-level API for accessing document-level structures with a PDF file. Document
|
// a convenient, higher-level API for accessing document-level structures within a PDF file.
|
||||||
// helpers are always initialized with a reference to a QPDF object, and the object can always be
|
// Document helpers are always initialized with a reference to a QPDF object, and the object can
|
||||||
// retrieved. The intention is that you may freely intermix use of document helpers with the
|
// always be retrieved. The intention is that you may freely intermix use of document helpers with
|
||||||
// underlying QPDF object unless there is a specific comment in a specific helper method that says
|
// the underlying QPDF object unless there is a specific comment in a specific helper method that
|
||||||
// otherwise. The pattern of using helper objects was introduced to allow creation of higher level
|
// says otherwise. The pattern of using helper objects was introduced to allow creation of higher
|
||||||
// helper functions without polluting the public interface of QPDF.
|
// level helper functions without polluting the public interface of QPDF.
|
||||||
|
|
||||||
class QPDF_DLL_CLASS QPDFDocumentHelper
|
class QPDF_DLL_CLASS QPDFDocumentHelper
|
||||||
{
|
{
|
||||||
|
@ -55,7 +55,7 @@ class QPDFEFStreamObjectHelper: public QPDFObjectHelper
|
|||||||
// Return the checksum as stored in the object as a binary string. This does not check
|
// Return the checksum as stored in the object as a binary string. This does not check
|
||||||
// consistency with the data. If not present, return an empty string. The PDF spec specifies
|
// consistency with the data. If not present, return an empty string. The PDF spec specifies
|
||||||
// this as an MD5 checksum and notes that it is not to be used for security purposes since MD5
|
// this as an MD5 checksum and notes that it is not to be used for security purposes since MD5
|
||||||
// is known not to be secure.
|
// is known to be insecure.
|
||||||
QPDF_DLL
|
QPDF_DLL
|
||||||
std::string getChecksum();
|
std::string getChecksum();
|
||||||
|
|
||||||
|
@ -31,14 +31,14 @@ class QPDFLogger
|
|||||||
static std::shared_ptr<QPDFLogger> create();
|
static std::shared_ptr<QPDFLogger> create();
|
||||||
|
|
||||||
// Return the default logger. In general, you should use the default logger. You can also create
|
// Return the default logger. In general, you should use the default logger. You can also create
|
||||||
// your own loggers and use them QPDF and QPDFJob objects, but there are few reasons to do so.
|
// your own loggers and use them with QPDF and QPDFJob objects, but there are few reasons to do
|
||||||
// One reason may if you are using multiple QPDF or QPDFJob objects in different threads and
|
// so. One reason may be that you are using multiple QPDF or QPDFJob objects in different
|
||||||
// want to capture output and errors to different streams. (Note that a single QPDF or QPDFJob
|
// threads and want to capture output and errors to different streams. (Note that a single QPDF
|
||||||
// can't be safely used from multiple threads, but it is safe to use separate QPDF and QPDFJob
|
// or QPDFJob can't be safely used from multiple threads, but it is safe to use separate QPDF
|
||||||
// objects on separate threads.) Another possible reason would be if you are writing an
|
// and QPDFJob objects on separate threads.) Another possible reason would be if you are writing
|
||||||
// application that uses the qpdf library directly and qpdf is also used by a downstream library
|
// an application that uses the qpdf library directly and qpdf is also used by a downstream
|
||||||
// or if you are using qpdf from a library and don't want to interfere with potential uses of
|
// library or if you are using qpdf from a library and don't want to interfere with potential
|
||||||
// qpdf by other libraries or applications.
|
// uses of qpdf by other libraries or applications.
|
||||||
QPDF_DLL
|
QPDF_DLL
|
||||||
static std::shared_ptr<QPDFLogger> defaultLogger();
|
static std::shared_ptr<QPDFLogger> defaultLogger();
|
||||||
|
|
||||||
|
@ -52,7 +52,7 @@ class QPDF_DLL_CLASS QPDFNameTreeObjectHelper: public QPDFObjectHelper
|
|||||||
QPDF_DLL
|
QPDF_DLL
|
||||||
virtual ~QPDFNameTreeObjectHelper();
|
virtual ~QPDFNameTreeObjectHelper();
|
||||||
|
|
||||||
// Return whether the number tree has an explicit entry for this number.
|
// Return whether the name tree has an explicit entry for this name.
|
||||||
QPDF_DLL
|
QPDF_DLL
|
||||||
bool hasName(std::string const& utf8);
|
bool hasName(std::string const& utf8);
|
||||||
|
|
||||||
@ -151,7 +151,7 @@ class QPDF_DLL_CLASS QPDFNameTreeObjectHelper: public QPDFObjectHelper
|
|||||||
iterator insert(std::string const& key, QPDFObjectHandle value);
|
iterator insert(std::string const& key, QPDFObjectHandle value);
|
||||||
|
|
||||||
// Remove an item. Return true if the item was found and removed; otherwise return false. If
|
// Remove an item. Return true if the item was found and removed; otherwise return false. If
|
||||||
// value is not null, initialize it to the value that was removed.
|
// value is not nullptr, initialize it to the value that was removed.
|
||||||
QPDF_DLL
|
QPDF_DLL
|
||||||
bool remove(std::string const& key, QPDFObjectHandle* value = nullptr);
|
bool remove(std::string const& key, QPDFObjectHandle* value = nullptr);
|
||||||
|
|
||||||
|
@ -145,7 +145,7 @@ class QPDF_DLL_CLASS QPDFNumberTreeObjectHelper: public QPDFObjectHelper
|
|||||||
value_type ivalue;
|
value_type ivalue;
|
||||||
};
|
};
|
||||||
|
|
||||||
// The iterator looks like map iterator, so i.first is a string and i.second is a
|
// The iterator looks like map iterator, so i.first is a numtree_number and i.second is a
|
||||||
// QPDFObjectHandle. Incrementing end() brings you to the first item. Decrementing end() brings
|
// QPDFObjectHandle. Incrementing end() brings you to the first item. Decrementing end() brings
|
||||||
// you to the last item.
|
// you to the last item.
|
||||||
QPDF_DLL
|
QPDF_DLL
|
||||||
@ -166,7 +166,7 @@ class QPDF_DLL_CLASS QPDFNumberTreeObjectHelper: public QPDFObjectHelper
|
|||||||
iterator insert(numtree_number key, QPDFObjectHandle value);
|
iterator insert(numtree_number key, QPDFObjectHandle value);
|
||||||
|
|
||||||
// Remove an item. Return true if the item was found and removed; otherwise return false. If
|
// Remove an item. Return true if the item was found and removed; otherwise return false. If
|
||||||
// value is not null, initialize it to the value that was removed.
|
// value is not nullptr, initialize it to the value that was removed.
|
||||||
QPDF_DLL
|
QPDF_DLL
|
||||||
bool remove(numtree_number key, QPDFObjectHandle* value = nullptr);
|
bool remove(numtree_number key, QPDFObjectHandle* value = nullptr);
|
||||||
|
|
||||||
|
@ -26,7 +26,7 @@
|
|||||||
// This is a base class for QPDF Object Helper classes. Object helpers are classes that provide a
|
// This is a base class for QPDF Object Helper classes. Object helpers are classes that provide a
|
||||||
// convenient, higher-level API for working with specific types of QPDF objects. Object helpers are
|
// convenient, higher-level API for working with specific types of QPDF objects. Object helpers are
|
||||||
// always initialized with a QPDFObjectHandle, and the underlying object handle can always be
|
// always initialized with a QPDFObjectHandle, and the underlying object handle can always be
|
||||||
// retrieved. The intention is that you may freely intermix use of document helpers with the
|
// retrieved. The intention is that you may freely intermix use of object helpers with the
|
||||||
// underlying QPDF objects unless there is a specific comment in a specific helper method that says
|
// underlying QPDF objects unless there is a specific comment in a specific helper method that says
|
||||||
// otherwise. The pattern of using helper objects was introduced to allow creation of higher level
|
// otherwise. The pattern of using helper objects was introduced to allow creation of higher level
|
||||||
// helper functions without polluting the public interface of QPDFObjectHandle.
|
// helper functions without polluting the public interface of QPDFObjectHandle.
|
||||||
|
@ -55,7 +55,7 @@ class QPDFOutlineDocumentHelper: public QPDFDocumentHelper
|
|||||||
QPDF_DLL
|
QPDF_DLL
|
||||||
QPDFObjectHandle resolveNamedDest(QPDFObjectHandle name);
|
QPDFObjectHandle resolveNamedDest(QPDFObjectHandle name);
|
||||||
|
|
||||||
// Return a list outlines that are known to target the specified page
|
// Return a list outlines that are known to target the specified page.
|
||||||
QPDF_DLL
|
QPDF_DLL
|
||||||
std::vector<QPDFOutlineObjectHelper> getOutlinesForPage(QPDFObjGen const&);
|
std::vector<QPDFOutlineObjectHelper> getOutlinesForPage(QPDFObjGen const&);
|
||||||
|
|
||||||
|
@ -37,7 +37,7 @@ class QPDFOutlineObjectHelper: public QPDFObjectHelper
|
|||||||
virtual ~QPDFOutlineObjectHelper()
|
virtual ~QPDFOutlineObjectHelper()
|
||||||
{
|
{
|
||||||
// This must be cleared explicitly to avoid circular references that prevent cleanup of
|
// This must be cleared explicitly to avoid circular references that prevent cleanup of
|
||||||
// pointer holders.
|
// shared pointers.
|
||||||
m->parent = nullptr;
|
m->parent = nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -66,11 +66,11 @@ class QPDFOutlineObjectHelper: public QPDFObjectHelper
|
|||||||
|
|
||||||
// Returns the value of /Count as present in the object, or 0 if not present. If count is
|
// Returns the value of /Count as present in the object, or 0 if not present. If count is
|
||||||
// positive, the outline is open. If negative, it is closed. Either way, the absolute value is
|
// positive, the outline is open. If negative, it is closed. Either way, the absolute value is
|
||||||
// the number descendant items that would be visible if this were open.
|
// the number of descendant items that would be visible if this were open.
|
||||||
QPDF_DLL
|
QPDF_DLL
|
||||||
int getCount();
|
int getCount();
|
||||||
|
|
||||||
// Returns the title as a UTF-8 string. Returns the empty string if there is no title.
|
// Returns the title as a UTF-8 string. Returns an empty string if there is no title.
|
||||||
QPDF_DLL
|
QPDF_DLL
|
||||||
std::string getTitle();
|
std::string getTitle();
|
||||||
|
|
||||||
|
@ -56,7 +56,7 @@ class QPDFPageDocumentHelper: public QPDFDocumentHelper
|
|||||||
QPDF_DLL
|
QPDF_DLL
|
||||||
void removeUnreferencedResources();
|
void removeUnreferencedResources();
|
||||||
|
|
||||||
// Add new page at the beginning or the end of the current pdf. The newpage parameter may be
|
// Add a new page at the beginning or the end of the current pdf. The newpage parameter may be
|
||||||
// either a direct object, an indirect object from this QPDF, or an indirect object from another
|
// either a direct object, an indirect object from this QPDF, or an indirect object from another
|
||||||
// QPDF. If it is a direct object, it will be made indirect. If it is an indirect object from
|
// QPDF. If it is a direct object, it will be made indirect. If it is an indirect object from
|
||||||
// another QPDF, this method will call pushInheritedAttributesToPage on the other file and then
|
// another QPDF, this method will call pushInheritedAttributesToPage on the other file and then
|
||||||
@ -76,7 +76,7 @@ class QPDFPageDocumentHelper: public QPDFDocumentHelper
|
|||||||
// This method does not have any specific awareness of annotations or form fields, so if you
|
// This method does not have any specific awareness of annotations or form fields, so if you
|
||||||
// just add a page without thinking about it, you might end up with two pages that share form
|
// just add a page without thinking about it, you might end up with two pages that share form
|
||||||
// fields or annotations. While the page may look fine, it will probably not function properly
|
// fields or annotations. While the page may look fine, it will probably not function properly
|
||||||
// with regard to interactive features. To work around this, you should called
|
// with regard to interactive features. To work around this, you should call
|
||||||
// QPDFAcroFormDocumentHelper::fixCopiedAnnotations. A future version of qpdf will likely
|
// QPDFAcroFormDocumentHelper::fixCopiedAnnotations. A future version of qpdf will likely
|
||||||
// provide a higher-level interface for copying pages around that will handle document-level
|
// provide a higher-level interface for copying pages around that will handle document-level
|
||||||
// constructs in a less error-prone fashion.
|
// constructs in a less error-prone fashion.
|
||||||
|
@ -103,11 +103,11 @@ class QPDFWriter
|
|||||||
// Setting Output. Output may be set only one time. If you don't use the filename version of
|
// Setting Output. Output may be set only one time. If you don't use the filename version of
|
||||||
// the QPDFWriter constructor, you must call exactly one of these methods.
|
// the QPDFWriter constructor, you must call exactly one of these methods.
|
||||||
|
|
||||||
// Passing null as filename means write to stdout. QPDFWriter will create a zero-length output
|
// Passing nullptr as filename means write to stdout. QPDFWriter will create a zero-length
|
||||||
// file upon construction. If write fails, the empty or partially written file will not be
|
// output file upon construction. If write fails, the empty or partially written file will not
|
||||||
// deleted. This is by design: sometimes the partial file may be useful for tracking down
|
// be deleted. This is by design: sometimes the partial file may be useful for tracking down
|
||||||
// problems. If your application doesn't want the partially written file to be left behind, you
|
// problems. If your application doesn't want the partially written file to be left behind, you
|
||||||
// should delete it the eventual call to write fails.
|
// should delete it if the eventual call to write fails.
|
||||||
QPDF_DLL
|
QPDF_DLL
|
||||||
void setOutputFilename(char const* filename);
|
void setOutputFilename(char const* filename);
|
||||||
|
|
||||||
@ -184,8 +184,8 @@ class QPDFWriter
|
|||||||
//
|
//
|
||||||
// qpdf_dl_generalized: This is the default. QPDFWriter will apply LZWDecode, ASCII85Decode,
|
// qpdf_dl_generalized: This is the default. QPDFWriter will apply LZWDecode, ASCII85Decode,
|
||||||
// ASCIIHexDecode, and FlateDecode filters on the input. When combined with
|
// ASCIIHexDecode, and FlateDecode filters on the input. When combined with
|
||||||
// setCompressStreams(true), which the default, the effect of this is that streams filtered with
|
// setCompressStreams(true), which is the default, the effect of this is that streams filtered
|
||||||
// these older and less efficient filters will be recompressed with the Flate filter. By
|
// with these older and less efficient filters will be recompressed with the Flate filter. By
|
||||||
// default, as a special case, if a stream is already compressed with FlateDecode and
|
// default, as a special case, if a stream is already compressed with FlateDecode and
|
||||||
// setCompressStreams is enabled, the original compressed data will be preserved. This behavior
|
// setCompressStreams is enabled, the original compressed data will be preserved. This behavior
|
||||||
// can be overridden by calling setRecompressFlate(true).
|
// can be overridden by calling setRecompressFlate(true).
|
||||||
|
@ -224,7 +224,7 @@ namespace QUtil
|
|||||||
QPDF_DLL
|
QPDF_DLL
|
||||||
time_t get_current_time();
|
time_t get_current_time();
|
||||||
|
|
||||||
// Portable structure representing a point in time with second granularity and time zone offset
|
// Portable structure representing a point in time with second granularity and time zone offset.
|
||||||
struct QPDFTime
|
struct QPDFTime
|
||||||
{
|
{
|
||||||
QPDFTime() = default;
|
QPDFTime() = default;
|
||||||
|
@ -109,7 +109,7 @@ extern "C" {
|
|||||||
#endif /* QPDF_NO_WCHAR_T */
|
#endif /* QPDF_NO_WCHAR_T */
|
||||||
|
|
||||||
/* This function wraps QPDFJob::initializeFromJson. The return value is the same as qpdfjob_run.
|
/* This function wraps QPDFJob::initializeFromJson. The return value is the same as qpdfjob_run.
|
||||||
* If this returns an error, it is invalid to call any other functions this job handle.
|
* If this returns an error, it is invalid to call any other functions using this job handle.
|
||||||
*/
|
*/
|
||||||
QPDF_DLL
|
QPDF_DLL
|
||||||
int qpdfjob_initialize_from_json(qpdfjob_handle j, char const* json);
|
int qpdfjob_initialize_from_json(qpdfjob_handle j, char const* json);
|
||||||
@ -135,7 +135,8 @@ extern "C" {
|
|||||||
/* This function wraps QPDFJob::writeQPDF. It returns the error code that qpdf would return with
|
/* This function wraps QPDFJob::writeQPDF. It returns the error code that qpdf would return with
|
||||||
* the equivalent command-line invocation. Exit code values are defined in Constants.h in the
|
* the equivalent command-line invocation. Exit code values are defined in Constants.h in the
|
||||||
* qpdf_exit_code_e type. NOTE it is the callers responsibility to clean up the resources
|
* qpdf_exit_code_e type. NOTE it is the callers responsibility to clean up the resources
|
||||||
* associated qpdf_data object by calling qpdf_cleanup after the call to qpdfjob_write_qpdf.
|
* associated with the qpdf_data object by calling qpdf_cleanup after the call to
|
||||||
|
* qpdfjob_write_qpdf.
|
||||||
*/
|
*/
|
||||||
QPDF_DLL
|
QPDF_DLL
|
||||||
int qpdfjob_write_qpdf(qpdfjob_handle j, qpdf_data qpdf);
|
int qpdfjob_write_qpdf(qpdfjob_handle j, qpdf_data qpdf);
|
||||||
|
@ -44,10 +44,10 @@ NNTreeIterator::updateIValue(bool allow_invalid)
|
|||||||
// various cases to ensure we don't introduce that bug in the future, but sadly it's tricky to
|
// various cases to ensure we don't introduce that bug in the future, but sadly it's tricky to
|
||||||
// verify by reasoning about the code that this constraint is always satisfied. Whenever we
|
// verify by reasoning about the code that this constraint is always satisfied. Whenever we
|
||||||
// update what the iterator points to, we should call setItemNumber, which calls this. If we
|
// update what the iterator points to, we should call setItemNumber, which calls this. If we
|
||||||
// change what the iterator in some other way, such as replacing a value or removing an item and
|
// change what the iterator points to in some other way, such as replacing a value or removing
|
||||||
// making the iterator point at a different item in potentially the same position, we must call
|
// an item and making the iterator point at a different item in potentially the same position,
|
||||||
// updateIValue as well. These cases are handled, and for good measure, we also call
|
// we must call updateIValue as well. These cases are handled, and for good measure, we also
|
||||||
// updateIValue in operator* and operator->.
|
// call updateIValue in operator* and operator->.
|
||||||
|
|
||||||
bool okay = false;
|
bool okay = false;
|
||||||
if ((item_number >= 0) && this->node.isDictionary()) {
|
if ((item_number >= 0) && this->node.isDictionary()) {
|
||||||
@ -226,7 +226,7 @@ NNTreeIterator::split(QPDFObjectHandle to_split, std::list<PathElement>::iterato
|
|||||||
// Split some node along the path to the item pointed to by this iterator, and adjust the
|
// Split some node along the path to the item pointed to by this iterator, and adjust the
|
||||||
// iterator so it points to the same item.
|
// iterator so it points to the same item.
|
||||||
|
|
||||||
// In examples, for simplicity, /Nums is show to just contain numbers instead of pairs. Imagine
|
// In examples, for simplicity, /Nums is shown to just contain numbers instead of pairs. Imagine
|
||||||
// this tree:
|
// this tree:
|
||||||
//
|
//
|
||||||
// root: << /Kids [ A B C D ] >>
|
// root: << /Kids [ A B C D ] >>
|
||||||
|
@ -232,7 +232,7 @@ void
|
|||||||
QPDFArgParser::handleArgFileArguments()
|
QPDFArgParser::handleArgFileArguments()
|
||||||
{
|
{
|
||||||
// Support reading arguments from files. Create a new argv. Ensure that argv itself as well as
|
// Support reading arguments from files. Create a new argv. Ensure that argv itself as well as
|
||||||
// all its contents are automatically deleted by using shared pointers to back the pointers in
|
// all its contents are automatically deleted by using shared pointers back to the pointers in
|
||||||
// argv.
|
// argv.
|
||||||
m->new_argv.push_back(QUtil::make_shared_cstr(m->argv[0]));
|
m->new_argv.push_back(QUtil::make_shared_cstr(m->argv[0]));
|
||||||
for (int i = 1; i < m->argc; ++i) {
|
for (int i = 1; i < m->argc; ++i) {
|
||||||
|
@ -1346,8 +1346,8 @@ QPDFWriter::unparseObject(
|
|||||||
// Make a shallow copy of this object so we can modify it safely without affecting the
|
// Make a shallow copy of this object so we can modify it safely without affecting the
|
||||||
// original. This code has logic to skip certain keys in agreement with prepareFileForWrite
|
// original. This code has logic to skip certain keys in agreement with prepareFileForWrite
|
||||||
// and with skip_stream_parameters so that replacing them doesn't leave unreferenced objects
|
// and with skip_stream_parameters so that replacing them doesn't leave unreferenced objects
|
||||||
// in the output. We can use unsafeShallowCopy here because we are all we are doing is
|
// in the output. We can use unsafeShallowCopy here because all we are doing is removing or
|
||||||
// removing or replacing top-level keys.
|
// replacing top-level keys.
|
||||||
object = object.unsafeShallowCopy();
|
object = object.unsafeShallowCopy();
|
||||||
|
|
||||||
// Handle special cases for specific dictionaries.
|
// Handle special cases for specific dictionaries.
|
||||||
@ -1701,7 +1701,7 @@ QPDFWriter::writeObjectStream(QPDFObjectHandle object)
|
|||||||
}
|
}
|
||||||
QPDFObjectHandle obj_to_write = m->pdf.getObject(obj);
|
QPDFObjectHandle obj_to_write = m->pdf.getObject(obj);
|
||||||
if (obj_to_write.isStream()) {
|
if (obj_to_write.isStream()) {
|
||||||
// This condition occurred in a fuzz input. Ideally we should block it at at parse
|
// This condition occurred in a fuzz input. Ideally we should block it at parse
|
||||||
// time, but it's not clear to me how to construct a case for this.
|
// time, but it's not clear to me how to construct a case for this.
|
||||||
QTC::TC("qpdf", "QPDFWriter stream in ostream");
|
QTC::TC("qpdf", "QPDFWriter stream in ostream");
|
||||||
obj_to_write.warnIfPossible("stream found inside object stream; treating as null");
|
obj_to_write.warnIfPossible("stream found inside object stream; treating as null");
|
||||||
|
Loading…
Reference in New Issue
Block a user