diff --git a/Makefile b/Makefile index 2e5ec23..cd84720 100644 --- a/Makefile +++ b/Makefile @@ -23,7 +23,7 @@ all : native-code native-code-library byte-code-library top htdoc clean :: rm -rf doc foo foo2 out.pdf out2.pdf foo.pdf decomp.pdf *.cmt *.cmti \ - *.json test/*.pdf debug/*.pdf *.ps *.aux *.idx *.log *.out *.toc + *.json test/*.pdf debug/*.pdf *.ps *.aux *.idx *.log *.out *.toc *.cut DOC_FILES = cpdfunicodedata.mli cpdferror.mli cpdfdebug.mli cpdfjson.mli \ cpdfstrftime.mli cpdfcoord.mli cpdfattach.mli cpdfpagespec.mli \ diff --git a/cpdfmanual.pdf b/cpdfmanual.pdf index 0077da9..7126a61 100644 Binary files a/cpdfmanual.pdf and b/cpdfmanual.pdf differ diff --git a/cpdfmanual.tex b/cpdfmanual.tex index 7867eb6..6f9fdfd 100644 --- a/cpdfmanual.tex +++ b/cpdfmanual.tex @@ -4,7 +4,7 @@ \excludecomment{cpdflib} \excludecomment{pycpdflib} \excludecomment{dotnetcpdflib} -\excludecomment{jcpdflib} +\includecomment{jcpdflib} \usepackage{palatino} \usepackage{listings} \usepackage{microtype} @@ -1059,9 +1059,10 @@ Use the \texttt{-no-embed-font} to avoid embedding the Standard 14 Font metrics \begin{jcpdflib} \clearpage -\section*{.NET Interface} +\section*{Java Interface} \begin{small}\tt \lstinputlisting{javasplits/cm1} +\lstinputlisting{javasplits/c00} \lstinputlisting{javasplits/c01} \lstinputlisting{javasplits/c02} \end{small} diff --git a/javasplits/c00.tex b/javasplits/c00.tex index c3d5c8f..f24d0be 100644 --- a/javasplits/c00.tex +++ b/javasplits/c00.tex @@ -1,24 +1,171 @@ -Cpdf +// Enumerations -The Coherent PDF Library for .NET +/** Permission: cannot edit the document */ +public static int noEdit = 0; +/** Permission: cannot print the document */ +public static int noPrint = 1; +/** Permission: cannot copy the document */ +public static int noCopy = 2; +/** Permission: cannot annotate the document */ +public static int noAnnot = 3; +/** Permission: cannot edit forms in the document */ +public static int noForms = 4; +/** Permission: cannot extract information */ +public static int noExtract = 5; +/** Permission: cannot assemble into a bigger document */ +public static int noAssemble = 6; +/** Permission: cannot print high quality */ +public static int noHqPrint = 7; -Cpdf.Pdf +/** Encryption method: 40 bit RC4 encryption */ +public static int pdf40bit = 0; +/** Encryption method: 128 bit RC4 encryption */ +public static int pdf128bit = 1; +/** Encryption method: 128 bit AES encryption, do not encrypt metadata */ +public static int aes128bitfalse = 2; +/** Encryption method: 128 bit AES encryption, encrypt metadata */ +public static int aes128bittrue = 3; +/** Encryption method: Deprecated. Do not use for new files */ +public static int aes256bitfalse = 4; +/** Encryption method: Deprecated. Do not use for new files */ +public static int aes256bittrue = 5; +/** Encryption method: 256 bit AES encryption, do not encrypt metadata */ +public static int aes256bitisofalse = 6; +/** Encryption method: 256 bit AES encryption, encrypt metadata */ +public static int aes256bitisotrue = 7; -PDF document. Use the 'using' keyword, or call Dispose to make sure PDFs are -deallocated. +/** Page label style: 1, 2, 3... */ +public static int decimalArabic = 0; +/** Page label style: I, II, III... */ +public static int uppercaseRoman = 1; +/** Page label style: i, ii, iii... */ +public static int lowercaseRoman = 2; +/** Page label style: A, B, C... */ +public static int uppercaseLetters = 3; +/** Page label style: a, b, c...*/ +public static int lowercaseLetters = 4; -Cpdf.Pdf.Dispose +/** Layout: single page */ +public static int singlePage = 0; +/** Layout: one column */ +public static int oneColumn = 1; +/** Layout: two column left */ +public static int twoColumnLeft = 2; +/** Layout: two column right */ +public static int twoColumnRight = 3; +/** Layout: two page left */ +public static int twoPageLeft = 4; +/** Layout: two page right */ +public static int twoPageRight = 5; -Force disposal of the PDF. +/** Page mode: use none */ +public static int useNone = 0; +/** Page mode: use outlines */ +public static int useOutlines = 1; +/** Page mode: use thumbs */ +public static int useThumbs = 2; +/** Page mode: use OC */ +public static int useOC = 3; +/** Page mode: use Attachments */ +public static int useAttachments = 4; -Cpdf.Pdf.Finalize +/** Paper size: A0 Portrait */ +public static int a0portrait = 0; +/** Paper size: A1 Portrait */ +public static int a1portrait = 1; +/** Paper size: A2 Portrait */ +public static int a2portrait = 2; +/** Paper size: A3 Portrait */ +public static int a3portrait = 3; +/** Paper size: A4 Portrait */ +public static int a4portrait = 4; +/** Paper size: A5 Portrait */ +public static int a5portrait = 5; +/** Paper size: A0 Landscape */ +public static int a0landscape = 6; +/** Paper size: A1 Landscape */ +public static int a1landscape = 7; +/** Paper size: A2 Landscape */ +public static int a2landscape = 8; +/** Paper size: A3 Landscape */ +public static int a3landscape = 9; +/** Paper size: A4 Landscape */ +public static int a4landscape = 10; +/** Paper size: A5 Landscape */ +public static int a5landscape = 11; +/** Paper size: US Letter Portrait */ +public static int usletterportrait = 12; +/** Paper size: US Letter Landscape */ +public static int usletterlandscape = 13; +/** Paper size: US Legal Portrait */ +public static int uslegalportrait = 14; +/** Paper size: US Legal Landscape */ +public static int uslegallandscape = 15; -Class destructor +/** Standard font: Times Roman */ +public static int timesRoman = 0; +/** Standard font: Times Bold */ +public static int timesBold = 1; +/** Standard font: Times Italic */ +public static int timesItalic = 2; +/** Standard font: Times Bold Italic */ +public static int timesBoldItalic = 3; +/** Standard font: Helvetica */ +public static int helvetica = 4; +/** Standard font: Helvetica Bold */ +public static int helveticaBold = 5; +/** Standard font: Helvetica Oblique */ +public static int helveticaOblique = 6; +/** Standard font: Helvetica Bold Oblique */ +public static int helveticaBoldOblique = 7; +/** Standard font: Courier */ +public static int courier = 8; +/** Standard font: Courier Bold */ +public static int courierBold = 9; +/** Standard font: Courier Oblique */ +public static int courierOblique = 10; +/** Standard font: Courier Bold Oblique */ +public static int courierBoldOblique = 11; -Cpdf.CPDFError - -Any function in this library may raise the CPDFError exception. - -Cpdf.CPDFError.#ctor(String) - -Construct a CPDFError which carries a string. +/** Position anchor: absolute centre. Takes two numbers, x and y. */ +public static int posCentre = 0; +/** Position anchor: absolute left. Takes two numbers, x and y. */ +public static int posLeft = 1; +/** Position anchor: absolute right. Takes two numbers, x and y. */ +public static int posRight = 2; +/** Position anchor: the top centre of the page. +Takes one number - distance from top. Second number ignored. */ +public static int top = 3; +/** Position anchor: the top left of the page. +Takes one numbers - distance from top left. Second number ignored. */ +public static int topLeft = 4; +/** Position anchor: the top right of the page. +Takes one number - distance from top right. Second number ignored. */ +public static int topRight = 5; +/** Position anchor: the left hand side of the page, halfway down. +Takes one number - distance from left middle. Second number ignored. */ +public static int left = 6; +/** Position anchor: the bottom left of the page. +Takes one number - distance from bottom left. Second number ignored. */ +public static int bottomLeft = 7; +/** Position anchor: the bottom middle of the page. +Takes one number - distance from bottom middle. Second number ignored. */ +public static int bottom = 8; +/** Position anchor: the bottomm right of the page. +Takes one number - distance from bottom right. Second number ignored. */ +public static int bottomRight = 9; +/** Position anchor: the right hand side of the page, halfway down. +Takes one number - distance from right middle. Second number ignored. */ +public static int right = 10; +/** Position anchor: diagonal, bottom left to top right. +Takes no numbers. Both numbers ignored. */ +public static int diagonal = 11; +/** Position anchor: diagonal, top left to bottom right. +Takes no numbers. Both numbers ignored. */ +public static int reverseDiagonal = 12; +/** Justification: left */ +public static int leftJustify = 0; +/** Justification: centre */ +public static int centreJustify = 1; +/** Justification: right */ +public static int rightJusitfy = 2; diff --git a/javasplits/c01.tex b/javasplits/c01.tex index be10f5a..51c78a1 100644 --- a/javasplits/c01.tex +++ b/javasplits/c01.tex @@ -1,39 +1,24 @@ -CHAPTER 0. Preliminaries +/* CHAPTER 0. Preliminaries */ -Cpdf.startup +/** Initialises the library. Must be called before any other function. */ +public native void startup() throws CpdfError; -Initialises the library. Must be called before any other function. +/** Returns a string giving the version number of the Jcpdf library. */ +public native String version() throws CpdfError; -Cpdf.version +/** Sets fast mode. Some operations have a fast mode. The default is 'slow' +mode, which works even on old-fashioned files. For more details, see +section 1.13 of the CPDF manual. This functions sets the mode to fast +globally. */ +public native void setFast() throws CpdfError; -Returns a string giving the version number of the CPDF library. +/** Sets slow mode. Some operations have a fast mode. The default is 'slow' +mode, which works even on old-fashioned files. For more details, see +section 1.13 of the CPDF manual. This functions sets the mode to slow +globally. */ +public native void setSlow() throws CpdfError; -Cpdf.setFast - -Some operations have a fast mode. The default is 'slow' mode, which works even -on old-fashioned files. For more details, see section 1.13 of the CPDF manual. -This function sets the mode to fast globally. - -Cpdf.setSlow - -Some operations have a fast mode. The default is 'slow' mode, which works even -on old-fashioned files. For more details, see section 1.13 of the CPDF manual. -This functions sets the mode to slow globally. - -Cpdf.lastError - -Not to be called directly. Errors in .NET cpdf are raised by exceptions. - -Cpdf.lastErrorString - -Not to be called directly. Errors in .NET cpdf are raised by exceptions. - -Cpdf.clearError - -Not to be called directly. Errors in .NET cpdf are raised by exceptions. - -Cpdf.onExit - -A debug function which prints some information about resource usage. This can -be used to detect if PDFs or ranges are being deallocated properly. Contrary to -its name, it may be run at any time. +/** Prints some information about +resource usage. This can be used to detect if PDFs or ranges are being +deallocated properly. Contrary to its name, it may be run at any time. */ +public native void onExit(); diff --git a/javasplits/c02.tex b/javasplits/c02.tex index 05b0224..77e5245 100644 --- a/javasplits/c02.tex +++ b/javasplits/c02.tex @@ -1,266 +1,256 @@ -CHAPTER 1. Basics +/* CHAPTER 1. Basics */ -Cpdf.fromFile(String, String) +/** Loads a PDF document from a file. Supply +a user password (possibly blank) in case the file is encrypted. It won't be +decrypted, but sometimes the password is needed just to load the file. +@param filename file name +@param userpw user password */ +public Pdf fromFile(String filename, String userpw) throws CpdfError; + +/** Loads a PDF document from a file, doing only minimal +parsing. The objects will be read and parsed when they are actually +needed. Use this when the whole file won't be required. Also supply a user +password (possibly blank) in case the file is encrypted. It won't be +decrypted, but sometimes the password is needed just to load the file. -Loads a PDF file from a given file. Supply a user password (possibly blank) in -case the file is encrypted. It won't be decrypted, but sometimes the password -is needed just to load the file. +@param filename file name +@param userpw user password */ +public Pdf fromFileLazy(String filename, String userpw) throws CpdfError; -Cpdf.fromFileLazy(String, String) +/** Loads a PDF document from memory. Supply +a user password (possibly blank) in case the file is encrypted. It won't be +decrypted, but sometimes the password is needed just to load the file. -Loads a PDF from a file, doing only minimal parsing. The objects will be read -and parsed when they are actually needed. Use this when the whole file won't be -required. Also supply a user password (possibly blank) in case the file is -encrypted. It won't be decrypted, but sometimes the password is needed just to -load the file. +@param data byte array containing the PDF file +@param userpw user password */ +public Pdf fromMemory(byte[] data, String userpw) throws CpdfError; -Cpdf.fromMemory(Byte[], String) +/** Loads a file from memory and the user +password, but lazily like {@link #fromFileLazy(String, String) +fromFileLazy}. The caller must use {@link #fromMemoryLazyRelease(byte[]) +fromMemoryLazyRelease} to free the memory. It must not free the memory +until the PDF is also gone. */ +public Pdf fromMemoryLazy(byte[] data, String userpw) throws CpdfError; -Loads a file from memory given any user password. +/** Releases memory returned from +{@link #fromMemoryLazy(byte[], String) fromMemoryLazy} +@param data byte array previously passed to {@link #fromMemoryLazy(byte[], +String) fromMemoryLazy} */ +public native void fromMemoryLazyRelease(byte[] data) throws CpdfError; -Cpdf.fromMemoryLazy(IntPtr, Int32, String) +/** Begins enumerating currently allocated PDFs. -Loads a file from memory, given a pointer and a length, and the user password, -but lazily like fromFileLazy. The caller must use AllocHGlobal / Marshal.Copy / -FreeHGlobal itself. It must not free the memory until the PDF is also gone. +

To enumerate the list of currently allocated PDFs, call +{@link #startEnumeratePDFs() startEnumeratePDFs} which gives the number, +n, of PDFs allocated, then {@link #enumeratePDFsInfo(int) +enumeratePDFsInfo} and {@link #enumeratePDFsKey(int) enumeratePDFsKey} with +index numbers from 0...(n - 1). Call +{@link #endEnumeratePDFs() endEnumeratePDFs} to clean up. */ +public native int startEnumeratePDFs() throws CpdfError; -Cpdf.startEnumeratePDFs +/** Returns the key for a given PDF number. */ +public native int enumeratePDFsKey(int n) throws CpdfError; -Cpdf.enumeratePDFsKey(Int32) - -Cpdf.enumeratePDFsInfo(Int32) - -Cpdf.endEnumeratePDFs - -To enumerate the list of currently allocated PDFs, call startEnumeratePDFs -which gives the number, n, of PDFs allocated, then enumeratePDFsInfo and -enumeratePDFsKey with index numbers from 0...(n - 1). Call endEnumeratePDFs to -clean up. - -Cpdf.ptOfCm(Double) - -Converts a figure in centimetres to points (72 points to 1 inch) - -Cpdf.ptOfMm(Double) - -Converts a figure in millimetres to points (72 points to 1 inch) - -Cpdf.ptOfIn(Double) - -Converts a figure in inches to points (72 points to 1 inch) - -Cpdf.cmOfPt(Double) - -Converts a figure in points to centimetres (72 points to 1 inch) - -Cpdf.mmOfPt(Double) - -Converts a figure in points to millimetres (72 points to 1 inch) - -Cpdf.inOfPt(Double) - -Converts a figure in points to inches (72 points to 1 inch) - -Cpdf.parsePagespec(Cpdf.Pdf, String) - -Parses a page specification with reference to a given PDF (the PDF is supplied -so that page ranges which reference pages which do not exist are rejected). - -Cpdf.validatePagespec(String) - -Validates a page specification so far as is possible in the absence of the -actual document. Result is true if valid. - -Cpdf.stringOfPagespec(Cpdf.Pdf, List{Int32}) - -Builds a page specification from a page range. For example, the range -containing 1, 2, 3, 6, 7, 8 in a document of 8 pages might yield "1-3, 6-end" - -Cpdf.blankRange - -Creates a range with no pages in. - -Cpdf.range(Int32, Int32) - -Builds a range from one page to another inclusive. For example, range(3, 7) -gives the range 3, 4, 5, 6, 7 - -Cpdf.all(Cpdf.Pdf) - -The range containing all the pages in a given document. - -Cpdf.even(List{Int32}) - -Makes a range which contains just the even pages of another range. - -Cpdf.odd(List{Int32}) - -Makes a range which contains just the odd pages of another range. - -Cpdf.rangeUnion(List{Int32}, List{Int32}) - -Makes the union of two ranges giving a range containing the pages in range a -and range b. - -Cpdf.difference(List{Int32}, List{Int32}) - -Makes the difference of two ranges, giving a range containing all the pages in -a except for those which are also in b. - -Cpdf.removeDuplicates(List{Int32}) - -Deduplicates a range, making a new one. - -Cpdf.rangeLength(List{Int32}) - -Gives the number of pages in a range. - -Cpdf.rangeGet(List{Int32}, Int32) - -Gets the page number at position n in a range, -where n runs from 0 to rangeLength - 1. - -Cpdf.rangeAdd(List{Int32}, Int32) - -Adds the page to a range, if it is not already -there. - -Cpdf.isInRange(List{Int32}, Int32) - -Returns true if the page is in the range, -false otherwise. - -Cpdf.pages(Cpdf.Pdf) - -Returns the number of pages in a PDF. - -Cpdf.pagesFast(String, String) - -Returns the number of pages in a given PDF, with given user password. It tries -to do this as fast as possible, without loading the whole file. - -Cpdf.toFile(Cpdf.Pdf, String, Boolean, Boolean) - -Writes the file to a given filename. If linearize is true, it will be -linearized if a linearizer is available. If make_id is true, it will be given a -new ID. - -Cpdf.toFileExt(Cpdf.Pdf, String, Boolean, Boolean, Boolean, Boolean, Boolean) - -Writes the file to a given filename. If make_id is true, it will be given a new -ID. If preserve_objstm is true, existing object streams will be preserved. If -generate_objstm is true, object streams will be generated even if not -originally present. If compress_objstm is true, object streams will be -compressed (what we usually want). WARNING: the pdf argument will be invalid -after this call, and should be not be used again. - -Cpdf.toMemory(Cpdf.Pdf, Boolean, Boolean) - -Writes a PDF file and returns as an array of bytes. - -Cpdf.isEncrypted(Cpdf.Pdf) - -Returns true if a documented is encrypted, false otherwise. - -Cpdf.decryptPdf(Cpdf.Pdf, String) - -Attempts to decrypt a PDF using the given user password. An exception is raised -if the decryption fails. - -Cpdf.decryptPdfOwner(Cpdf.Pdf, String) - -Attempts to decrypt a PDF using the given owner password. Raises an exception -if the decryption fails. - -Cpdf.Permission - -Permissions - -Cpdf.Permission.NoEdit - -Cannot edit the document - -Cpdf.Permission.NoPrint - -Cannot print the document - -Cpdf.Permission.NoCopy - -Cannot copy the document - -Cpdf.Permission.NoAnnot - -Cannot annotate the document - -Cpdf.Permission.NoForms - -Cannot edit forms in the document - -Cpdf.Permission.NoExtract - -Cannot extract information - -Cpdf.Permission.NoAssemble - -Cannot assemble into a bigger document - -Cpdf.Permission.NoHqPrint - -Cannot print high quality - -Cpdf.EncryptionMethod - -Encryption methods - -Cpdf.EncryptionMethod.Pdf40bit - -40 bit RC4 encryption - -Cpdf.EncryptionMethod.Pdf128bit - -128 bit RC4 encryption - -Cpdf.EncryptionMethod.Aes128bitfalse - -128 bit AES encryption, do not encrypt metadata - -Cpdf.EncryptionMethod.Aes128bittrue - -128 bit AES encryption, encrypt metadata - -Cpdf.EncryptionMethod.Aes256bitfalse - -Deprecated. Do not use for new files - -Cpdf.EncryptionMethod.Aes256bittrue - -Deprecated. Do not use for new files - -Cpdf.EncryptionMethod.Aes256bitisofalse - -256 bit AES encryption, do not encrypt metadata - -Cpdf.EncryptionMethod.Aes256bitiosotrue - -256 bit AES encryption, encrypt metadata - -Cpdf.toFileEncrypted(Cpdf.Pdf, Cpdf.EncryptionMethod, List{Cpdf.Permission}, -String, String, Boolean, Boolean, String) - -Writes a file as encrypted. - -Cpdf.toFileEncryptedExt(Cpdf.Pdf, Cpdf.EncryptionMethod, List{Cpdf.Permission}, -String, String, Boolean, Boolean, Boolean, Boolean, Boolean, String) - -Writes a file as encrypted with extra parameters. WARNING: the pdf argument -will be invalid after this call, and should not be used again. - -Cpdf.hasPermission(Cpdf.Pdf, Cpdf.Permission) - -Returns true if the given permission -(restriction) is present. - -Cpdf.encryptionKind(Cpdf.Pdf) - -Returns the encryption method currently in use on -a document. +/** Returns the info for a given PDF number. */ +public native String enumeratePDFsInfo(int n) throws CpdfError; + +/** Ends enumeration of currently allocated PDFs. */ +public native void endEnumeratePDFs() throws CpdfError; + +/** Converts a figure in centimetres to points. (72 points to 1 inch) */ +public native double ptOfCm(double f) throws CpdfError; + +/** Converts a figure in millimetres to points. (72 points to 1 inch) */ +public native double ptOfMm(double f) throws CpdfError; + +/** Converts a figure in inches to points (72. points to 1 inch) */ +public native double ptOfIn(double f) throws CpdfError; + +/** Converts a figure in points to centimetres. (72 points to 1 inch) */ +public native double cmOfPt(double f) throws CpdfError; + +/** Converts a figure in points to millimetres. (72 points to 1 inch) */ +public native double mmOfPt(double f) throws CpdfError; + +/** Converts a figure in points to millimetres. (72 points to 1 inch) */ +public native double inOfPt(double f) throws CpdfError; + +/** Parses a page specification such as 1,2,6-end with +reference to a given PDF. (The PDF is supplied so that page ranges which +reference pages which do not exist are rejected). + +@param pdf PDF document +@param pagespec page specification */ +public native Range parsePagespec(Pdf pdf, String pagespec) + throws CpdfError; + +/** Validates a page specification so far as is possible in the absence of +the actual document. Result is true if valid. */ +public native boolean validatePagespec(String pagespec) throws CpdfError; + +/** Builds a page specification from a page range. For example, the range +containing 1,2,3,6,7,8 in a document of 8 pages might yield +"1-3,6-end" + +@param pdf PDF document +@param r page range +*/ +public String stringOfPagespec(Pdf pdf, Range r) throws CpdfError; + +/** The range containing no pages. */ +public native Range blankRange() throws CpdfError; + +/** The page range containing all page numbers from one page number to +another. +@param from page number to begin at (inclusive) +@param to page number to end at (inclusive) */ +public native Range range(int from, int to) throws CpdfError; + +/** The page range contaning all pages in a given document. */ +public native Range all(Pdf pdf) throws CpdfError; + +/** The page range containing all odd-numbered pages from an existing +range. */ +public native Range odd(Range r) throws CpdfError; + +/** The page range containing all even-numbered pages from an existing +range. */ +public native Range even(Range r) throws CpdfError; + +/** The union of two ranges - all those pages in either. */ +public native Range rangeUnion(Range r, Range s) throws CpdfError; + +/** The range containing all pages in the first given range which are not +in the second. */ +public native Range difference(Range r, Range s) throws CpdfError; + +/** Remove duplicates from a range, returning a new one. */ +public native Range removeDuplicates(Range r) throws CpdfError; + +/** The length of a range. */ +public native int rangeLength(Range r) throws CpdfError; + +/** Gets a page number from a range at the given offset. */ +public native int rangeGet(Range r, int n) throws CpdfError; + +/** Adds a page number to a range, returning a new one. */ +public native Range rangeAdd(Range r, int n) throws CpdfError; + +/** Tests to see if a given number is in a page range. */ +public native boolean isInRange(Range r, int n) throws CpdfError; + +/** Returns the number of pages in a PDF. */ +public native int pages(Pdf pdf) throws CpdfError; + +/** Returns the number of pages in a given +PDF, with given user password. It tries to do this as fast as +possible, without loading the whole file. +@param userpw user password +@param filename file name */ +public int pagesFast(String userpw, String filename) throws CpdfError; + +/** Writes the PDF document to a given filename. If linearize +is true, it will be linearized if a linearizer is available. +If make_id is true, it will be given a new ID. +@param pdf PDF document +@param filename file name +@param linearize linearize +@param make_id make new ID +*/ +public void toFile(Pdf pdf, String filename, boolean linearize, + boolean make_id) + throws CpdfError; + +/** Writes the PDF document to a given filename, with extra parameters. If +make_id is true, it will be given a new ID. If +preserve_objstm is true, existing object streams will be +preserved. If generate_objstm is true, object streams will be +generated even if not originally present. If compress_objstm +is true, object streams will be compressed (what we usually want). +WARNING: the pdf argument will be invalid after this call, and should not +be used again. +@param pdf PDF document +@param filename file name +@param linearize linearize +@param make_id make new ID +@param preserve_objstm preserve object streams +@param create_objstm create new object streams +@param compress_objstm compress object streams +*/ +public void toFileExt(Pdf pdf, String filename, boolean linearize, + boolean make_id, boolean preserve_objstm, + boolean create_objstm, boolean compress_objstm) + throws CpdfError; + +/** Writes a PDF document and returns it as an array of bytes. +@param pdf PDF document +@param linearize linearize +@param make_id make new ID +*/ +public native byte[] toMemory(Pdf pdf, boolean linearize, boolean make_id) + throws CpdfError; + +/** Returns true if a document is encrypted, +false otherwise. */ +public native boolean isEncrypted(Pdf pdf) throws CpdfError; + +/** Attempts to decrypt a PDF using the given +user password. An exception is raised if the decryption fails. +@param pdf PDF document +@param userpw user password */ +public void decryptPdf(Pdf pdf, String userpw) throws CpdfError; + +/** Attempts to decrypt a PDF using the given owner password. Raises an +exception if the decryption fails. +@param pdf PDF document +@param ownerpw owner password */ +public void decryptPdfOwner(Pdf pdf, String ownerpw) throws CpdfError; + +/** Writes a PDF document as encrypted. The encryption method and +permissions are drawn from Jcpdf's fields, documented above. +@param pdf PDF document +@param encryption_method encryption method, e.g + {@link #aes256bitisofalse aes256bitisofalse} +@param permissions array of permissions e.g {@link #noEdit noEdit} +@param owner_password owner password +@param user_password user password +@param linearize linearize +@param makeid make new ID +@param filename file name */ +public void toFileEncrypted(Pdf pdf, int encryption_method, + int[] permissions, String owner_password, + String user_password, boolean linearize, + boolean makeid, String filename) + throws CpdfError; + +/** Writes a file as encrypted with extra parameters. WARNING: the pdf +argument will be invalid after this call, and should not be used again. + +@param pdf PDF document +@param encryption_method encryption method, e.g + {@link #aes256bitisofalse aes256bitisofalse} +@param permissions array of permissions e.g {@link #noEdit noEdit} +@param owner_password owner password +@param user_password user password +@param linearize linearize +@param makeid make new ID +@param preserve_objstm preserve existing object streams +@param generate_objstm generate new object streams +@param compress_objstm compress object streams +@param filename file name */ +public void toFileEncryptedExt(Pdf pdf, int encryption_method, + int[] permissions, String owner_password, + String user_password, boolean linearize, + boolean makeid, boolean preserve_objstm, + boolean generate_objstm, + boolean compress_objstm, String filename) + throws CpdfError; + +/** Returns true if the given permission (restriction) such as +{@link #noEdit noEdit} is present. */ +public native boolean hasPermission(Pdf pdf, int permission) + throws CpdfError; + +/** Returns the encryption method currently in use on a document, such as +{@link #aes256bitisofalse aes256bitisofalse}. */ +public native int encryptionKind(Pdf pdf) throws CpdfError; diff --git a/javasplits/c03.tex b/javasplits/c03.tex index b730467..2596e5c 100644 --- a/javasplits/c03.tex +++ b/javasplits/c03.tex @@ -1,22 +1,33 @@ -CHAPTER 2. Merging and Splitting +/* CHAPTER 2. Merging and Splitting */ -Cpdf.mergeSimple(List{Cpdf.Pdf}) +/** Given an array of PDFs, merges the documents into a new one, which is +returned. */ +public native Pdf mergeSimple(Pdf[] pdfs) throws CpdfError; -Given a list of PDFs, merges the files into a new one, which is returned. +/** Merges the PDFs. If retain_numbering is true page labels +are not rewritten. If remove_duplicate_fonts is true, +duplicate fonts are merged. This is useful when the source documents for +merging originate from the same source. +@param pdfs array of PDF documents +@param retain_numbering retain page numbering in output +@param remove_duplicate_fonts remove duplicate font data by merging */ +public native Pdf merge(Pdf[] pdfs, boolean retain_numbering, + boolean remove_duplicate_fonts) + throws CpdfError; -Cpdf.merge(List{Cpdf.Pdf}, Boolean, Boolean) +/** Merges PDFs when one or more are drawn from the same document. It has +an additional argument - a list of page ranges. This is used to select the +pages to pick from each PDF. This avoids duplication of information when +multiple discrete parts of a source PDF are included. +@param pdfs array of PDF documents +@param retain_numbering retain page numbering in output +@param remove_duplicate_fonts remove duplicate font data by merging +@param ranges array of ranges, one for each PDF*/ +public native Pdf mergeSame(Pdf[] pdfs, boolean retain_numbering, + boolean remove_duplicate_fonts, Range[] ranges) + throws CpdfError; -Merges the PDFs. If retain_numbering is true page labels are not rewritten. If -remove_duplicate_fonts is true, duplicate fonts are merged. This is useful when -the source documents for merging originate from the same source. - -Cpdf.mergeSame(List{Cpdf.Pdf}, Boolean, Boolean, List{List{Int32}}) - -The same as merge, except that it has an additional argument - a list of page -ranges. This is used to select the pages to pick from each PDF. This avoids -duplication of information when multiple discrete parts of a source PDF are -included. - -Cpdf.selectPages(Cpdf.Pdf, List{Int32}) - -Returns a new document which just those pages in the page range. +/** Returns a new document with just those pages in the page range. + * @param pdf PDF document + * @param range range*/ +public native Pdf selectPages(Pdf pdf, Range range) throws CpdfError; diff --git a/javasplits/c04.tex b/javasplits/c04.tex index 765c883..7111834 100644 --- a/javasplits/c04.tex +++ b/javasplits/c04.tex @@ -1,235 +1,134 @@ -CHAPTER 3. Pages - -Cpdf.scalePages(Cpdf.Pdf, List{Int32}, Double, Double) - -Scales the page dimensions and content by the given scale, about (0, 0). Other -boxes (crop etc. are altered as appropriate) - -Cpdf.scaleToFit(Cpdf.Pdf, List{Int32}, Double, Double, Double) - -Scales the content to fit new page dimensions (width x height) multiplied by -scale (typically 1.0). Other boxes (crop etc. are altered as appropriate) - -Cpdf.Papersize - -Built-in paper sizes - -Cpdf.Papersize.A0portrait - -A0 Portrait paper - -Cpdf.Papersize.A1portrait - -A1 Portrait paper - -Cpdf.Papersize.A2portrait - -A2 Portrait paper - -Cpdf.Papersize.A3portrait - -A3 Portrait paper - -Cpdf.Papersize.A4portrait - -A4 Portrait paper - -Cpdf.Papersize.A5portrait - -A5 Portrait paper - -Cpdf.Papersize.A0landscape - -A0 Landscape paper - -Cpdf.Papersize.A1landscape - -A1 Landscape paper - -Cpdf.Papersize.A2landscape - -A2 Landscape paper - -Cpdf.Papersize.A3landscape - -A3 Landscape paper - -Cpdf.Papersize.A4landscape - -A4 Landscape paper - -Cpdf.Papersize.A5landscape - -A5 Landscape paper - -Cpdf.Papersize.Usletterportrait - -US Letter Portrait paper - -Cpdf.Papersize.Usletterlandscape - -US Letter Landscape paper - -Cpdf.Papersize.Uslegalportrait - -US Legal Portrait paper - -Cpdf.Papersize.Uslegallandscape - -US Legal Landscape paper - -Cpdf.scaleToFitPaper(Cpdf.Pdf, List{Int32}, Cpdf.Papersize, Double) - -Scales the page content to fit the given page size, possibly multiplied by -scale (typically 1.0) - -Cpdf.Anchor - -Position anchors - -Cpdf.Anchor.PosCentre - -Absolute centre - -Cpdf.Anchor.PosLeft - -Absolute left - -Cpdf.Anchor.PosRight - -Absolute right - -Cpdf.Anchor.Top - -The top centre of the page - -Cpdf.Anchor.TopLeft - -The top left of the page - -Cpdf.Anchor.TopRight - -The top right of the page - -Cpdf.Anchor.Left - -The left hand side of the page, halfway down - -Cpdf.Anchor.BottomLeft - -The bottom left of the page - -Cpdf.Anchor.Bottom - -The bottom middle of the page - -Cpdf.Anchor.BottomRight - -The bottom right of the page - -Cpdf.Anchor.Right - -The right hand side of the page, halfway down - -Cpdf.Anchor.Diagonal - -Diagonal, bottom left to top right - -Cpdf.Anchor.ReverseDiagonal - -Diagonal, top left to bottom right - -Cpdf.Position - -Cpdf.Position.anchor - -Position anchor - -Cpdf.Position.coord1 - -Parameter one - -Cpdf.Position.coord2 - -Parameter two - -Cpdf.Position.#ctor(Cpdf.Anchor) - -Build a position with zero parameters - -Cpdf.Position.#ctor(Cpdf.Anchor, Double) - -Build a position with one parameter - -Cpdf.Position.#ctor(Cpdf.Anchor, Double, Double) - -Build a position with two parameters - -Cpdf.scaleContents(Cpdf.Pdf, List{Int32}, Cpdf.Position, Double) - -Scales the contents of the pages in the range about the point given by the -position, by the scale given. - -Cpdf.shiftContents(Cpdf.Pdf, List{Int32}, Double, Double) - -Shifts the content of the pages in the range. - -Cpdf.rotate(Cpdf.Pdf, List{Int32}, Int32) - -Changes the viewing rotation to an absolute value. Appropriate rotations are 0, -90, 180, 270. - -Cpdf.rotateBy(Cpdf.Pdf, List{Int32}, Int32) - -Rotates the content about the centre of the page by the given number of +/* CHAPTER 3. Pages */ + +/** Scales the page dimensions +and content by the given scale, about (0, 0). Other boxes (crop etc. are +altered as appropriate). +@param pdf PDF document +@param range page range +@param sx X scale +@param sy Y scale*/ +public native void scalePages(Pdf pdf, Range range, double sx, double sy) + throws CpdfError; + +/** Scales the content to fit new page dimensions (width x height) +multiplied by scale (typically 1.0). Other boxes (crop etc. are altered as +appropriate). +@param pdf PDF document +@param range page range +@param w width in points +@param h height in points +@param scale scale (typically 1.0) +*/ +public native void scaleToFit(Pdf pdf, Range range, double w, double h, + double scale) + throws CpdfError; + +/** Scales the page content to fit the given page size, possibly multiplied +by scale (typically 1.0). +@param pdf PDF document +@param range page range +@param papersize paper size, such as {@link #a4portrait a0portrait} +@param scale scale (typically 1.0) +*/ +public native void scaleToFitPaper(Pdf pdf, Range range, int papersize, + double scale) + throws CpdfError; + +/** Scales the contents of the pages in the range about the point given by +the anchor, p1 and p2 by the scale +given. See the documentation for the chosen anchor. +@param pdf PDF document +@param range page range +@param anchor position anchor, such as {@link #posCentre posCentre} +@param p1 position parameter 1 +@param p2 position parameter 2 +@param scale scale +*/ +public native void scaleContents(Pdf pdf, Range range, int anchor, + double p1, double p2, double scale) + throws CpdfError; + +/** Shifts the content of the pages in the range. +@param pdf PDF document +@param range page range +@param dx X shift +@param dy Y shift +*/ +public native void shiftContents(Pdf pdf, Range range, double dx, + double dy) + throws CpdfError; + +/** Changes the viewing rotation to an absolute value. Appropriate +rotations are 0, 90, 180, 270. +@param pdf PDF document +@param range page range +@param angle viewing rotation +*/ +public native void rotate(Pdf pdf, Range range, int angle) + throws CpdfError; + +/** Changes the viewing rotation by a relative value. Appropriate +rotations are 0, 90, 180, 270. +@param pdf PDF document +@param range page range +@param angle viewing rotation +*/ +public native void rotateBy(Pdf pdf, Range range, int angle) + throws CpdfError; + +/** Rotates the content about the centre of the page by the given number of degrees, in a clockwise direction. +@param pdf PDF document +@param range page range +@param angle angle in degrees +*/ +public native void rotateContents(Pdf pdf, Range range, double angle) + throws CpdfError; -Cpdf.rotateContents(Cpdf.Pdf, List{Int32}, Double) +/** Changes the viewing rotation of the pages in the range, +counter-rotating the dimensions and content such that there is no visual +change. */ +public native void upright(Pdf pdf, Range range) throws CpdfError; -Rotates the content about the centre of the page by the given number of -degrees, in a clockwise direction. +/** Flips horizontally the pages in the range. */ +public native void hFlip(Pdf pdf, Range range) throws CpdfError; -Cpdf.upright(Cpdf.Pdf, List{Int32}) +/** Flips vertically the pages in the range. */ +public native void vFlip(Pdf pdf, Range range) throws CpdfError; -Changes the viewing rotation of the pages in the range, counter-rotating the -dimensions and content such that there is no visual change. +/** Crops a page, replacing any existing crop box. The dimensions are in +points. +@param pdf PDF document +@param range page range +@param x minimum X +@param y minimum Y +@param w width +@param h height */ +public native void crop(Pdf pdf, Range range, double x, double y, double w, + double h) + throws CpdfError; -Cpdf.hFlip(Cpdf.Pdf, List{Int32}) +/** Removes any crop box from pages in the range. */ +public native void removeCrop(Pdf pdf, Range range) throws CpdfError; -Flips horizontally the pages in the range. +/** Removes any trim box from pages in the range. */ +public native void removeTrim(Pdf pdf, Range range) throws CpdfError; -Cpdf.vFlip(Cpdf.Pdf, List{Int32}) +/** Removes any art box from pages in the range. */ +public native void removeArt(Pdf pdf, Range range) throws CpdfError; -Flips vertically the pages in the range. +/** Removes any bleed box from pages in the range. */ +public native void removeBleed(Pdf pdf, Range range) throws CpdfError; -Cpdf.crop(Cpdf.Pdf, List{Int32}, Double, Double, Double, Double) +/** Adds trim marks to the given pages, if the trimbox exists. */ +public native void trimMarks(Pdf pdf, Range range) throws CpdfError; -Crops a page, replacing any existing crop box. The dimensions are in points. +/** Shows the boxes on the given pages, for debug. */ +public native void showBoxes(Pdf pdf, Range range) throws CpdfError; -Cpdf.removeCrop(Cpdf.Pdf, List{Int32}) - -Removes any crop box from pages in the range. - -Cpdf.removeTrim(Cpdf.Pdf, List{Int32}) - -Removes any trim box from pages in the range. - -Cpdf.removeArt(Cpdf.Pdf, List{Int32}) - -Removes any art box from pages in the range. - -Cpdf.removeBleed(Cpdf.Pdf, List{Int32}) - -Removes any bleed box from pages in the range. - -Cpdf.trimMarks(Cpdf.Pdf, List{Int32}) - -Adds trim marks to the given pages, if the trimbox exists. - -Cpdf.showBoxes(Cpdf.Pdf, List{Int32}) - -Shows the boxes on the given pages, for debug. - -Cpdf.hardBox(Cpdf.Pdf, List{Int32}, String) - -Makes a given box a 'hard box' i.e clips it explicitly. +/** Makes a given box a 'hard box' i.e clips it explicitly. +@param pdf PDF document +@param range page range +@param box box name e.g "/CropBox" */ +public native void hardBox(Pdf pdf, Range range, String box) + throws CpdfError; diff --git a/javasplits/c05.tex b/javasplits/c05.tex index 72fb05e..b9958df 100644 --- a/javasplits/c05.tex +++ b/javasplits/c05.tex @@ -1,3 +1,2 @@ -CHAPTER 4. Encryption - -Encryption covered in Chapter 1. +/* CHAPTER 4. Encryption */ +/* Encryption covered under Chapter 1 in cpdflib. */ diff --git a/javasplits/c06.tex b/javasplits/c06.tex index 27d0a0f..a0666f1 100644 --- a/javasplits/c06.tex +++ b/javasplits/c06.tex @@ -1,14 +1,12 @@ -CHAPTER 5. Compression +/* CHAPTER 5. Compression */ -Cpdf.compress(Cpdf.Pdf) +/** Compresses any uncompressed streams in the given PDF using the Flate +algorithm. */ +public native void compress(Pdf pdf) throws CpdfError; -Compresses any uncompressed streams in the given PDF using the Flate algorithm. +/** Decompresses any streams in the given PDF, so long as the compression +method is supported. */ +public native void decompress(Pdf pdf) throws CpdfError; -Cpdf.decompress(Cpdf.Pdf) - -Decompresses any streams in the given PDF, so long as the compression method is -supported. - -Cpdf.squeezeInMemory(Cpdf.Pdf) - -Squeezes a pdf in memory. +/** Squeezes a pdf in memory. */ +public native void squeezeInMemory(Pdf pdf) throws CpdfError; diff --git a/javasplits/c07.tex b/javasplits/c07.tex index d3549f6..4dfb068 100644 --- a/javasplits/c07.tex +++ b/javasplits/c07.tex @@ -1,68 +1,68 @@ -CHAPTER 6. Bookmarks +/* CHAPTER 6. Bookmarks */ -Cpdf.startGetBookmarkInfo(Cpdf.Pdf) +/** Starts the bookmark retrieval process for a given PDF. */ +public native void startGetBookmarkInfo(Pdf pdf) throws CpdfError; -Starts the bookmark retrieval process for a given PDF. +/** Gets the number of bookmarks for the PDF given to {@link +#startGetBookmarkInfo(Pdf) startGetBookmarkInfo}. */ +public native int numberBookmarks() throws CpdfError; -Cpdf.numberBookmarks +/** Gets the bookmark level for the given bookmark +0...(n - 1). */ +public native int getBookmarkLevel(int serial) throws CpdfError; -Gets the number of bookmarks for the PDF given to startGetBookmarkInfo. +/** Gets the bookmark target page for the given PDF (which must be the +same as the PDF passed to {@link #startGetBookmarkInfo(Pdf) +startGetBookmarkInfo}) and bookmark 0...(n - 1). */ +public native int getBookmarkPage(Pdf pdf, int serial) throws CpdfError; -Cpdf.getBookmarkLevel(Int32) +/** Returns the text of bookmark 0...(n - 1)) */ +public String getBookmarkText(int serial) throws CpdfError; -Gets the bookmark level for the given bookmark (0...(n - 1)). +/** Returns true if the bookmark is open. */ +public native boolean getBookmarkOpenStatus(int serial) throws CpdfError; -Cpdf.getBookmarkPage(Cpdf.Pdf, Int32) +/** Ends the bookmark retrieval process, cleaning up. */ +public native void endGetBookmarkInfo() throws CpdfError; -Gets the bookmark target page for the given PDF (which must be the same as the -PDF passed to startSetBookmarkInfo) and bookmark (0...(n - 1)). +/** Starts the bookmark setting process for n bookmarks. */ +public native void startSetBookmarkInfo(int n) throws CpdfError; -Cpdf.getBookmarkText(Int32) +/** Set bookmark level for the given bookmark 0...(n - 1). */ +public native void setBookmarkLevel(int serial, int level) + throws CpdfError; -Returns the text of bookmark (0...(n - 1)). +/** Sets the bookmark target page for the given PDF (which must be the same +as the PDF to be passed to {@link #endSetBookmarkInfo(Pdf) +endSetBookmarkInfo}) and bookmark 0...(n - 1). */ +public native void setBookmarkPage(Pdf pdf, int serial, int pagenum) + throws CpdfError; -Cpdf.getBookmarkOpenStatus(Int32) +/** Sets the open status of bookmark 0...(n - 1). */ +public native void setBookmarkOpenStatus(int serial, boolean open) + throws CpdfError; -True if the bookmark is open. +/** Sets the text of bookmark 0...(n - 1). */ +public void setBookmarkText(int serial, String text) throws CpdfError; -Cpdf.endGetBookmarkInfo +/** Ends the bookmark setting process, writing the bookmarks to the given +PDF. */ +public native void endSetBookmarkInfo(Pdf pdf) throws CpdfError; -Ends the bookmark retrieval process, cleaning up. +/** Returns the bookmark data in JSON format. */ +public native byte[] getBookmarksJSON(Pdf pdf) throws CpdfError; -Cpdf.startSetBookmarkInfo(Int32) +/** Sets the bookmarks from JSON bookmark data. */ +public native void setBookmarksJSON(Pdf pdf, byte[] data) throws CpdfError; -Starts the bookmark setting process for n bookmarks. - -Cpdf.setBookmarkLevel(Int32, Int32) - -Set bookmark level for the given bookmark (0...(n - 1)). - -Cpdf.setBookmarkPage(Cpdf.Pdf, Int32, Int32) - -Sets the bookmark target page for the given PDF (which must be the same as the -PDF to be passed to endSetBookmarkInfo) and bookmark (0...(n - 1)). - -Cpdf.setBookmarkOpenStatus(Int32, Boolean) - -Sets the open status of bookmark (0...(n - 1)). - -Cpdf.setBookmarkText(Int32, String) - -Sets the text of bookmark (0...(n - 1)). - -Cpdf.endSetBookmarkInfo(Cpdf.Pdf) - -Ends the bookmark setting process, writing the bookmarks to the given PDF. - -Cpdf.getBookmarksJSON(Cpdf.Pdf) - -Returns the bookmark data in JSON format. - -Cpdf.setBookmarksJSON(Cpdf.Pdf, Byte[]) - -Sets the bookmarks from JSON bookmark data. - -Cpdf.tableOfContents(Cpdf.Pdf, Cpdf.Font, Double, String, Boolean) - -Typesets a table of contents from existing bookmarks and prepends it to the -document. If bookmark is set, the table of contents gets its own bookmark. +/** Typesets a table of contents from existing bookmarks and prepends it to +the document. +@param pdf PDF document +@param font font, such as {@link #timesRoman timesRoman} +@param fontsize font size +@param title table of contents title +@param bookmark if true, the table of contents gets its own +bookmark. */ +public void tableOfContents(Pdf pdf, int font, double fontsize, + String title, boolean bookmark) + throws CpdfError; diff --git a/javasplits/c08.tex b/javasplits/c08.tex index 9b5c52e..a7a7aad 100644 --- a/javasplits/c08.tex +++ b/javasplits/c08.tex @@ -1,3 +1,2 @@ -CHAPTER 7. Presentations - -Not included in the library version of cpdf. +/* CHAPTER 7. Presentations */ +/* Not included in the library version. */ diff --git a/javasplits/c09.tex b/javasplits/c09.tex index d1c6dbe..37a662f 100644 --- a/javasplits/c09.tex +++ b/javasplits/c09.tex @@ -1,123 +1,120 @@ -CHAPTER 8. Logos, Watermarks and Stamps +/* CHAPTER 8. Logos, Watermarks and Stamps */ -Cpdf.stampOn(Cpdf.Pdf, Cpdf.Pdf, List{Int32}) +/** Stamps another PDF on top of all the pages in the document which are in +the range. The stamp is placed with its origin at the origin of the target +document. +@param stamp_pdf stamp PDF document +@param pdf PDF document +@param range page range */ +public native void stampOn(Pdf stamp_pdf, Pdf pdf, Range range) + throws CpdfError; -Stamps stamp_pdf on top of all the pages in the document which are in the +/** Stamps another PDF under all the pages in the document which are in the range. The stamp is placed with its origin at the origin of the target document. +@param stamp_pdf stamp PDF document +@param pdf PDF document +@param range page range */ +public native void stampUnder(Pdf stamp_pdf, Pdf pdf, Range range) + throws CpdfError; -Cpdf.stampUnder(Cpdf.Pdf, Cpdf.Pdf, List{Int32}) +/** A stamping function with extra features. +@param pdf first PDF document +@param pdf2 second PDF document +@param range page range +@param isover if true, pdf goes over +pdf2 otherwise under +@param scale_stamp_to_fit if true scales the stamp to fit +the page. +@param anchor position anchor, such as {@link #posCentre posCentre} +@param p1 position parameter one +@param p2 position parameter two +@param relative_to_cropbox if true, the position is relative +to the crop box rather than the media box. */ +public native void stampExtended(Pdf pdf, Pdf pdf2, Range range, + boolean isover, + boolean scale_stamp_to_fit, int anchor, + double p1, double p2, + boolean relative_to_cropbox) + throws CpdfError; -Stamps stamp_pdf under all the pages in the document which are in the range. -The stamp is placed with its origin at the origin of the target document. +/** Combines the two PDFs page-by-page, putting each page of 'over' over +each page of 'under'. */ +public native Pdf combinePages(Pdf under, Pdf over) throws CpdfError; -Cpdf.stampExtended(Cpdf.Pdf, Cpdf.Pdf, List{Int32}, Boolean, Boolean, -Cpdf.Position, Boolean) +/** Adds text to the pages in the given range. +@param metrics if true, only collect metrics +@param pdf PDF document +@param range page range +@param text the text to stamp, including any special codes +@param anchor position anchor, such as {@link #posCentre posCentre} +@param p1 position parameter one +@param p2 position parameter two +@param linespacing line spacing +@param bates starting bates number +@param font font, such as {@link #timesRoman timesRoman} +@param fontsize font size +@param r red component of colour +@param g green component of colour +@param b blue component of colour +@param underneath if true, text goes under page +@param cropbox if true, +relative to cropbox rather than media box +@param outline text is outline +@param opacity opacity +@param justification justification, +such as {@link #leftJustify leftJustify} +@param midline position is relative to midline not baseline +@param topline position is relative to topline not baseline +@param filename file name, if requied by special code in text +@param linewidth line width +@param embed_fonts if true, embed fonts +*/ +public void addText(boolean metrics, Pdf pdf, Range range, String text, + int anchor, double p1, double p2, double linespacing, + int bates, int font, double fontsize, double r, + double g, double b, boolean underneath, + boolean cropbox, boolean outline, double opacity, + int justification, boolean midline, boolean topline, + String filename, double linewidth, boolean embed_fonts) + throws CpdfError; -A stamping function with extra features. - isover true, pdf goes over pdf2, -isover false, pdf goes under pdf2 - scale_stamp_to_fit scales the stamp to fit -the page - pos gives the position to put the stamp - relative_to_cropbox: if -true, pos is relative to cropbox not mediabox. +/** Adds text with most parameters default. +@param pdf PDF document +@param range page range +@param text the text to stamp, including any special codes +@param anchor position anchor, such as {@link #posCentre posCentre} +@param p1 position parameter one +@param p2 position parameter two +@param font font, such as {@link #timesRoman timesRoman} +@param fontsize font size +*/ +public void addTextSimple(Pdf pdf, Range range, String text, int anchor, + double p1, double p2, int font, double fontsize) + throws CpdfError; -Cpdf.combinePages(Cpdf.Pdf, Cpdf.Pdf) +/** Removes any text added by Jcpdf from the given pages. */ +public native void removeText(Pdf pdf, Range range) throws CpdfError; -Combines the PDFs page-by-page, putting each page of 'over' over each page of -'under'. +/** Returns the width of a given string in the given font in thousandths of +a point. +@param font font, such as {@link #timesRoman timesRoman} +@param text text*/ +public int textWidth(int font, String text) throws CpdfError; -Cpdf.Font +/** Adds page content before or after the existing content to pages in the +given range in the given PDF. +@param s page content to add +@param before if true new content goes before, else after +@param pdf PDF document +@param range page range */ +public void addContent(String s, boolean before, Pdf pdf, Range range) + throws CpdfError; -Standard fonts - -Cpdf.Font.TimesRoman - -Times Roman - -Cpdf.Font.TimesBold - -Times Bold - -Cpdf.Font.TimesItalic - -Times Italic - -Cpdf.Font.TimesBoldItalic - -Times Bold Italic - -Cpdf.Font.Helvetica - -Helvetica - -Cpdf.Font.HelveticaBold - -Helvetica Bold - -Cpdf.Font.HelveticaOblique - -Helvetica Oblique - -Cpdf.Font.HelveticaBoldOblique - -Helvetica Bold Oblique - -Cpdf.Font.Courier - -Courier - -Cpdf.Font.CourierBold - -Courier Bold - -Cpdf.Font.CourierOblique - -Courier Oblique - -Cpdf.Font.CourierBoldOblique - -Courier Bold Oblique - -Cpdf.Justification - -Justifications - -Cpdf.Justification.LeftJustify - -Left justify - -Cpdf.Justification.CentreJustify - -Centre justify - -Cpdf.Justification.RightJustify - -Right justify - -Cpdf.addText(Boolean, Cpdf.Pdf, List{Int32}, String, Cpdf.Position, Double, -Int32, Cpdf.Font, Double, Double, Double, Double, Boolean, Boolean, Boolean, -Double, Cpdf.Justification, Boolean, Boolean, String, Double, Boolean) - -Adds text to the pages in the given range. - -Cpdf.addTextSimple(Cpdf.Pdf, List{Int32}, String, Cpdf.Position, Cpdf.Font, -Double) - -Adds text with most parameters default. - -Cpdf.removeText(Cpdf.Pdf, List{Int32}) - -Removes any text added by cpdf from the given pages. - -Cpdf.textWidth(Cpdf.Font, String) - -Returns the width of a given string in the given font in thousandths of a -point. - -Cpdf.addContent(String, Boolean, Cpdf.Pdf, List{Int32}) - -Adds page content before (if true) or after (if false) the existing content to -pages in the given range in the given PDF. - -Cpdf.stampAsXObject(Cpdf.Pdf, List{Int32}, Cpdf.Pdf) - -Stamps stamp_pdf onto the pages in the given range in pdf as a shared Form +/** Stamps a PDF onto the pages in the given range in pdf as a shared Form XObject. The name of the newly-created XObject is returned. +@param pdf PDF document +@param range page range +@param stamp_pdf PDF document to stamp */ +public native String stampAsXObject(Pdf pdf, Range range, Pdf stamp_pdf) + throws CpdfError; diff --git a/javasplits/c10.tex b/javasplits/c10.tex index 99b601a..6754907 100644 --- a/javasplits/c10.tex +++ b/javasplits/c10.tex @@ -1,40 +1,44 @@ -CHAPTER 9. Multipage facilities +/* CHAPTER 9. Multipage facilities */ -Cpdf.impose(Cpdf.Pdf, Double, Double, Boolean, Boolean, Boolean, Boolean, -Boolean, Double, Double, Double) +/** Imposes a PDF. +@param pdf PDF document +@param x x parameter +@param y y parameter +@param fit true: impose to fit a page of size x by y; +false: impose x by y +@param columns imposes by columns rather than rows +@param rtl impose right-to-left +@param btt impose bottom-to-top +@param center unused for now +@param margin margin around the output +@param spacing spacing between imposed inputs */ +public native void impose(Pdf pdf, double x, double y, boolean fit, + boolean columns, boolean rtl, boolean btt, + boolean center, double margin, double spacing, + double linewidth) + throws CpdfError; -Imposes a PDF. There are two modes: imposing x * y, or imposing to fit a page -of size x * y. This is controlled by fit. Columns imposes by columns rather -than rows. rtl is right-to-left, btt bottom-to-top. Center is unused for now. -Margin is the margin around the output, spacing the spacing between imposed -inputs. +/** Imposes a document two up. twoUp does so by shrinking the page size, to +fit two pages on one. */ +public native void twoUp(Pdf pdf) throws CpdfError; -Cpdf.twoUp(Cpdf.Pdf) +/** Imposes a document two up. twoUpStack does so by doubling the page +size, to fit two pages on one. */ +public native void twoUpStack(Pdf pdf) throws CpdfError; -Imposes a document two up. twoUpStack does so by doubling the page size, to fit -two pages on one. +/** Adds a blank page before each page in the given range. */ +public native void padBefore(Pdf pdf, Range range) throws CpdfError; -Cpdf.twoUpStack(Cpdf.Pdf) +/** Adds a blank page after each page in the given range. */ +public native void padAfter(Pdf pdf, Range range) throws CpdfError; -Impose a document two up. twoUpStack does so by doubling the page size, to fit -two pages on one. +/** Adds a blank page after every n pages. */ +public native void padEvery(Pdf pdf, int n) throws CpdfError; -Cpdf.padBefore(Cpdf.Pdf, List{Int32}) +/** Adds pages at the end to pad the file to a multiple of n pages in +length. */ +public native void padMultiple(Pdf pdf, int n) throws CpdfError; -Adds a blank page before each page in the given range. - -Cpdf.padAfter(Cpdf.Pdf, List{Int32}) - -Adds a blank page after each page in the given range. - -Cpdf.padEvery(Cpdf.Pdf, Int32) - -Adds a blank page after every n pages. - -Cpdf.padMultiple(Cpdf.Pdf, Int32) - -Adds pages at the end to pad the file to a multiple of n pages in length. - -Cpdf.padMultipleBefore(Cpdf.Pdf, Int32) - -Adds pages at the beginning to pad the file to a multiple of n pages in length. +/** Adds pages at the beginning to pad the file to a multiple of n pages in +length. */ +public native void padMultipleBefore(Pdf pdf, int n) throws CpdfError; diff --git a/javasplits/c11.tex b/javasplits/c11.tex index bf10106..df7c02c 100644 --- a/javasplits/c11.tex +++ b/javasplits/c11.tex @@ -1,5 +1,4 @@ -CHAPTER 10. Annotations +/* CHAPTER 10. Annotations */ -Cpdf.annotationsJSON(Cpdf.Pdf) - -Returns the annotations from a PDF in JSON format +/** Returns the annotations from a PDF in JSON format. */ +public native byte[] annotationsJSON(Pdf pdf) throws CpdfError; diff --git a/javasplits/c12.tex b/javasplits/c12.tex index be343b1..a594108 100644 --- a/javasplits/c12.tex +++ b/javasplits/c12.tex @@ -1,368 +1,287 @@ -CHAPTER 11. Document Information and Metadata +/* CHAPTER 11. Document Information and Metadata */ -Cpdf.isLinearized(String) +/** Finds out if a document is linearized as quickly as possible without +loading it. */ +public boolean isLinearized(String filename) throws CpdfError; -Finds out if a document is linearized as quickly as possible without loading -it. +/** Returns the minor version number of a document. */ +public native int getVersion(Pdf pdf) throws CpdfError; -Cpdf.getVersion(Cpdf.Pdf) +/** Returns the major version number of a document. */ +public native int getMajorVersion(Pdf pdf) throws CpdfError; -Returns the minor version number of a document. +/** Returns the title of a document. */ +public String getTitle(Pdf pdf) throws CpdfError; -Cpdf.getMajorVersion(Cpdf.Pdf) +/** Returns the author of a document. */ +public String getAuthor(Pdf pdf) throws CpdfError; -Returns the minor version number of a document. +/** Returns the subject of a document. */ +public String getSubject(Pdf pdf) throws CpdfError; -Cpdf.getTitle(Cpdf.Pdf) +/** Returns the keywords of a document. */ +public String getKeywords(Pdf pdf) throws CpdfError; -Returns the title of a document. +/** Returns the creator of a document. */ +public String getCreator(Pdf pdf) throws CpdfError; -Cpdf.getAuthor(Cpdf.Pdf) +/** Returns the producer of a document. */ +public String getProducer(Pdf pdf) throws CpdfError; -Returns the author of a document. +/** Returns the creation date of a document. */ +public String getCreationDate(Pdf pdf) throws CpdfError; -Cpdf.getSubject(Cpdf.Pdf) +/** Returns the modification date of a document. */ +public String getModificationDate(Pdf pdf) throws CpdfError; -Returns the subject of a document. +/** Returns the XMP title of a document. */ +public String getTitleXMP(Pdf pdf) throws CpdfError; -Cpdf.getKeywords(Cpdf.Pdf) +/** Returns the XMP author of a document. */ +public String getAuthorXMP(Pdf pdf) throws CpdfError; -Returns the keywords of a document. +/** Returns the XMP subject of a document. */ +public String getSubjectXMP(Pdf pdf) throws CpdfError; -Cpdf.getCreator(Cpdf.Pdf) +/** Returns the XMP keywords of a document. */ +public String getKeywordsXMP(Pdf pdf) throws CpdfError; -Returns the creator of a document. +/** Returns the XMP creator of a document. */ +public String getCreatorXMP(Pdf pdf) throws CpdfError; -Cpdf.getProducer(Cpdf.Pdf) +/** Returns the XMP producer of a document. */ +public String getProducerXMP(Pdf pdf) throws CpdfError; -Returns the producer of a document. +/** Returns the XMP creation date of a document. */ +public String getCreationDateXMP(Pdf pdf) throws CpdfError; -Cpdf.getCreationDate(Cpdf.Pdf) +/** Returns the XMP modification date of a document. */ +public String getModificationDateXMP(Pdf pdf) throws CpdfError; -Returns the creation date of a document. +/** Sets the title of a document. */ +public void setTitle(Pdf pdf, String str) throws CpdfError; -Cpdf.getModificationDate(Cpdf.Pdf) +/** Sets the author of a document. */ +public void setAuthor(Pdf pdf, String str) throws CpdfError; -Returns the modification date of a document. +/** Sets the subject of a document. */ +public void setSubject(Pdf pdf, String str) throws CpdfError; -Cpdf.getTitleXMP(Cpdf.Pdf) +/** Sets the keywords of a document. */ +public void setKeywords(Pdf pdf, String str) throws CpdfError; -Returns the XMP title of a document. +/** Sets the creator of a document. */ +public void setCreator(Pdf pdf, String str) throws CpdfError; -Cpdf.getAuthorXMP(Cpdf.Pdf) +/** Sets the producer of a document. */ +public void setProducer(Pdf pdf, String str) throws CpdfError; -Returns the XMP author of a document. +/** Sets the creation date of a document. */ +public void setCreationDate(Pdf pdf, String str) throws CpdfError; -Cpdf.getSubjectXMP(Cpdf.Pdf) +/** Sets the modification date of a document. */ +public void setModificationDate(Pdf pdf, String str) throws CpdfError; -Returns the XMP subject of a document. +/** Sets the XMP title of a document. */ +public void setTitleXMP(Pdf pdf, String str) throws CpdfError; -Cpdf.getKeywordsXMP(Cpdf.Pdf) +/** Sets the XMP author of a document. */ +public void setAuthorXMP(Pdf pdf, String str) throws CpdfError; -Returns the XMP keywords of a document. +/** Sets the XMP subject of a document. */ +public void setSubjectXMP(Pdf pdf, String str) throws CpdfError; -Cpdf.getCreatorXMP(Cpdf.Pdf) +/** Sets the XMP keywords of a document. */ +public void setKeywordsXMP(Pdf pdf, String str) throws CpdfError; -Returns the XMP creator of a document. +/** Sets the XMP creator of a document. */ +public void setCreatorXMP(Pdf pdf, String str) throws CpdfError; -Cpdf.getProducerXMP(Cpdf.Pdf) +/** Sets the XMP producer of a document. */ +public void setProducerXMP(Pdf pdf, String str) throws CpdfError; -Returns the XMP producer of a document. +/** Sets the XMP creation date of a document. */ +public void setCreationDateXMP(Pdf pdf, String str) throws CpdfError; -Cpdf.getCreationDateXMP(Cpdf.Pdf) +/** Sets the XMP modification date of a document. */ +public void setModificationDateXMP(Pdf pdf, String str) throws CpdfError; -Returns the XMP creation date of a document. +/** Returns the components from a PDF date string in an array of length 8. +@param datestring date string +@param r return array */ +public native void getDateComponents(String datestring, int[] r) + throws CpdfError; -Cpdf.getModificationDateXMP(Cpdf.Pdf) +/** Builds a PDF date string from individual components. */ +public native String dateStringOfComponents(int year, int month, int day, + int hour, int minute, + int second, int hour_offset, + int minute_offset) + throws CpdfError; -Returns the XMP modification date of a document. +/** Gets the viewing rotation for a given page. */ +public native int getPageRotation(Pdf pdf, int pagenumber) + throws CpdfError; -Cpdf.setTitle(Cpdf.Pdf, String) +/** Returns true if the given page has the given box. E.g +"/CropBox". +@param pdf PDF document +@param pagenumber page number +@param boxname box name, e.g "/CropBox" */ +public native boolean hasBox(Pdf pdf, int pagenumber, String boxname) + throws CpdfError; -Sets the title of a document. +/** These functions get a box given the document. The values are returned +in a given array of length 4: min x, max x, min y, max y in points. Only +succeeds if such a box exists, as checked by {@link #hasBox(Pdf, int, +String) hasBox}. */ +public native void getMediaBox(Pdf pdf, int pagenumber, double[] r) + throws CpdfError; -Cpdf.setAuthor(Cpdf.Pdf, String) +public native void getCropBox(Pdf pdf, int pagenumber, double[] r) + throws CpdfError; -Sets the author of a document. +public native void getBleedBox(Pdf pdf, int pagenumber, double[] r) + throws CpdfError; -Cpdf.setSubject(Cpdf.Pdf, String) +public native void getArtBox(Pdf pdf, int pagenumber, double[] r) + throws CpdfError; -Sets the subject of a document. +public native void getTrimBox(Pdf pdf, int pagenumber, double[] r) + throws CpdfError; -Cpdf.setKeywords(Cpdf.Pdf, String) +/** These functions set a box given the document page range, min x, max x, +min y, max y in points. */ +public native void setMediabox(Pdf pdf, Range range, double minx, + double maxx, double miny, double maxy) + throws CpdfError; -Sets the keywords of a document. +public native void setCropBox(Pdf pdf, Range range, double minx, + double maxx, double miny, double maxy) + throws CpdfError; -Cpdf.setCreator(Cpdf.Pdf, String) +public native void setTrimBox(Pdf pdf, Range range, double minx, + double maxx, double miny, double maxy) + throws CpdfError; -Sets the creator of a document. +public native void setArtBox(Pdf pdf, Range range, double minx, + double maxx, double miny, double maxy) + throws CpdfError; -Cpdf.setProducer(Cpdf.Pdf, String) +public native void setBleedBox(Pdf pdf, Range range, double minx, + double maxx, double miny, double maxy) + throws CpdfError; -Sets the producer of a document. +/** Marks a document as trapped. */ +public native void markTrapped(Pdf pdf) throws CpdfError; -Cpdf.setCreationDate(Cpdf.Pdf, String) +/** Marks a document as untrapped. */ +public native void markUntrapped(Pdf pdf) throws CpdfError; -Sets the creation date of a document. +/** Marks a document as trapped in XMP metadata. */ +public native void markTrappedXMP(Pdf pdf) throws CpdfError; -Cpdf.setModificationDate(Cpdf.Pdf, String) +/** Marks a document as untrapped in XMP metadata. */ +public native void markUntrappedXMP(Pdf pdf) throws CpdfError; -Sets the modification date of a document. +/** Sets the page layout for a document, such as {@link #singlePage +singlePage} */ +public native void setPageLayout(Pdf pdf, int layout) throws CpdfError; -Cpdf.setTitleXMP(Cpdf.Pdf, String) +/** Sets the page mode for a document, such as {@link #useNone useNone} */ +public native void setPageMode(Pdf pdf, int mode) throws CpdfError; -Sets the XMP title of a document. +/** Sets the hide toolbar flag. */ +public native void hideToolbar(Pdf pdf, boolean flag) throws CpdfError; -Cpdf.setAuthorXMP(Cpdf.Pdf, String) +/** Sets the hide menubar flag. */ +public native void hideMenubar(Pdf pdf, boolean flag) throws CpdfError; -Sets the XMP author of a document. +/** Sets the hide window UI flag. */ +public native void hideWindowUi(Pdf pdf, boolean flag) throws CpdfError; -Cpdf.setSubjectXMP(Cpdf.Pdf, String) +/** Sets the fit window flag. */ +public native void fitWindow(Pdf pdf, boolean flag) throws CpdfError; -Sets the XMP subject of a document. +/** Sets the center window flag. */ +public native void centerWindow(Pdf pdf, boolean flag) throws CpdfError; -Cpdf.setKeywordsXMP(Cpdf.Pdf, String) +/** Sets the display document title flag. */ +public native void displayDocTitle(Pdf pdf, boolean flag) throws CpdfError; -Sets the XMP keywords of a document. +/** Sets the PDF to open, possibly with zoom-to-fit, at the given page +number. +@param pdf PDF document +@param fit if true zoom to fit +@param pagenumber page number */ +public native void openAtPage(Pdf pdf, boolean fit, int pagenumber) + throws CpdfError; -Cpdf.setCreatorXMP(Cpdf.Pdf, String) +/** Sets the XMP metadata of a document, given a file name. */ +public void setMetadataFromFile(Pdf pdf, String filename) throws CpdfError; -Sets the XMP creator of a document. +/** Sets the XMP metadata from an array of bytes. */ +public native void setMetadataFromByteArray(Pdf pdf, byte[] data) + throws CpdfError; -Cpdf.setProducerXMP(Cpdf.Pdf, String) +/** Removes the XMP metadata from a document. */ +public native void removeMetadata(Pdf pdf) throws CpdfError; -Sets the XMP producer of a document. +/** Returns the XMP metadata from a document. */ +public native byte[] getMetadata(Pdf pdf) throws CpdfError; -Cpdf.setCreationDateXMP(Cpdf.Pdf, String) +/** Builds fresh XMP metadata as best it can from +existing metadata in the document. */ +public native void createMetadata(Pdf pdf) throws CpdfError; -Sets the XMP creation date of a document. +/** Sets the metadata date for a PDF. The date is given in PDF date format. +Jcpdf will convert it to XMP format. The date "now" means now. */ +public native void setMetadataDate(Pdf pdf, String date) throws CpdfError; -Cpdf.setModificationDateXMP(Cpdf.Pdf, String) +/** Adds page labels to a document. +@param pdf PDF document +@param style label style, such as {@link #decimalArabic decimalArabic} +@param prefix text for each label +@param offset can be used to shift the numbering up or down +@param range page range +@param progress if true, labels progress */ +public void addPageLabels(Pdf pdf, int style, String prefix, int offset, + Range range, boolean progress) + throws CpdfError -Sets the XMP modification date of a document. +/** Removes the page labels from the document. */ +public native void removePageLabels(Pdf pdf) throws CpdfError; -Cpdf.getDateComponents(String, Int32@, Int32@, Int32@, Int32@, Int32@, Int32@, -Int32@, Int32@) +/** Calculates the full label string for a given page, and returns it. */ +public String getPageLabelStringForPage(Pdf pdf, int pagenumber) + throws CpdfError -Returns the components from a PDF date string. +/** Gets page label data. Call {@link #startGetPageLabels(Pdf) +startGetPageLabels} to find out how many there are, then use these serial +numbers to get the style, prefix, offset and start value (note not a +range). Call {@link #endGetPageLabels() endGetPageLabels} to clean up. -Cpdf.dateStringOfComponents(Int32, Int32, Int32, Int32, Int32, Int32, Int32, -Int32) +

For example, a document might have five pages of introduction with roman +numerals, followed by the rest of the pages in decimal arabic, numbered +from one: -Builds a PDF date string from individual components. +

labelstyle = LowercaseRoman
+labelprefix = ""
+startpage = 1
+startvalue = 1
-Cpdf.getPageRotation(Cpdf.Pdf, Int32) +

labelstyle = DecimalArabic
+labelprefix = ""
+startpage = 6
+startvalue = 1
*/ +public native int startGetPageLabels(Pdf pdf) throws CpdfError; -Gets the viewing rotation for a given page. +public native void endGetPageLabels() throws CpdfError; -Cpdf.hasBox(Cpdf.Pdf, Int32, String) +public native int getPageLabelOffset(int n) throws CpdfError; -Returns true, if that page has the given box. E.g "/CropBox". +public native int getPageLabelStyle(int n) throws CpdfError; -Cpdf.getMediaBox(Cpdf.Pdf, Int32, Double@, Double@, Double@, Double@) +public native int getPageLabelRange(int n) throws CpdfError; -Cpdf.getCropBox(Cpdf.Pdf, Int32, Double@, Double@, Double@, Double@) - -Cpdf.getTrimBox(Cpdf.Pdf, Int32, Double@, Double@, Double@, Double@) - -Cpdf.getArtBox(Cpdf.Pdf, Int32, Double@, Double@, Double@, Double@) - -Cpdf.getBleedBox(Cpdf.Pdf, Int32, Double@, Double@, Double@, Double@) - -These functions get a box given the document, page number, min x, max x, -min y, max y in points. Only succeeds if such a box exists, as checked by -hasBox. - -Cpdf.setMediabox(Cpdf.Pdf, List{Int32}, Double, Double, Double, Double) - -Cpdf.setCropBox(Cpdf.Pdf, List{Int32}, Double, Double, Double, Double) - -Cpdf.setTrimBox(Cpdf.Pdf, List{Int32}, Double, Double, Double, Double) - -Cpdf.setArtBox(Cpdf.Pdf, List{Int32}, Double, Double, Double, Double) - -Cpdf.setBleedBox(Cpdf.Pdf, List{Int32}, Double, Double, Double, Double) - -These functions set a box given the document, page range, min x, max x, -min y, max y in points. - -Cpdf.markTrapped(Cpdf.Pdf) - -Marks a document as trapped. - -Cpdf.markUntrapped(Cpdf.Pdf) - -Marks a document as untrapped. - -Cpdf.markTrappedXMP(Cpdf.Pdf) - -Marks a document as trapped in XMP metadata. - -Cpdf.markUntrappedXMP(Cpdf.Pdf) - -Marks a document as untrapped in XMP metadata. - -Cpdf.Layout - -Layouts - -Cpdf.Layout.SinglePage - -Single page - -Cpdf.Layout.OneColumn - -One column - -Cpdf.Layout.TwoColumnLeft - -Two column left - -Cpdf.Layout.TwoColumnRight - -Two column right - -Cpdf.Layout.TwoPageLeft - -Two page left - -Cpdf.Layout.TwoPageRight - -Two page right - -Cpdf.setPageLayout(Cpdf.Pdf, Cpdf.Layout) - -Sets the page layout for a document. - -Cpdf.PageMode - -Page modes - -Cpdf.PageMode.UseNone - -Use none - -Cpdf.PageMode.UseOutlines - -Use outlines - -Cpdf.PageMode.UseThumbs - -Use thumbs - -Cpdf.PageMode.UseOC - -Use OC - -Cpdf.PageMode.UseAttachments - -Use attachments - -Cpdf.setPageMode(Cpdf.Pdf, Cpdf.PageMode) - -Sets the page mode for a document. - -Cpdf.hideToolbar(Cpdf.Pdf, Boolean) - -Sets the hide toolbar flag. - -Cpdf.hideMenubar(Cpdf.Pdf, Boolean) - -Sets the hide menubar flag. - -Cpdf.hideWindowUi(Cpdf.Pdf, Boolean) - -Sets the hide window UI flag. - -Cpdf.fitWindow(Cpdf.Pdf, Boolean) - -Sets the fit window flag. - -Cpdf.centerWindow(Cpdf.Pdf, Boolean) - -Sets the center window flag. - -Cpdf.displayDocTitle(Cpdf.Pdf, Boolean) - -Sets the display doc title flag. - -Cpdf.openAtPage(Cpdf.Pdf, Boolean, Int32) - -Sets the PDF to open, possibly with zoom-to-fit, at the given page number. - -Cpdf.setMetadataFromFile(Cpdf.Pdf, String) - -Sets the XMP metadata of a document, given a file name. - -Cpdf.setMetadataFromByteArray(Cpdf.Pdf, Byte[]) - -Sets the XMP metadata from an array of bytes. - -Cpdf.removeMetadata(Cpdf.Pdf) - -Removes the XMP metadata from a document. - -Cpdf.getMetadata(Cpdf.Pdf) - -Returns the XMP metadata from a document. - -Cpdf.createMetadata(Cpdf.Pdf) - -Builds fresh metadata as best it can from -existing metadata in the document. - -Cpdf.setMetadataDate(Cpdf.Pdf, String) - -Sets the metadata date for a PDF. The date is given in PDF date format -- cpdf -will convert it to XMP format. The date 'now' means now. - -Cpdf.PageLabelStyle - -Page label styles - -Cpdf.PageLabelStyle.DecimalArabic - -1, 2, 3... - -Cpdf.PageLabelStyle.UppercaseRoman - -I, II, III... - -Cpdf.PageLabelStyle.LowercaseRoman - -i, ii, iii... - -Cpdf.PageLabelStyle.UppercaseLetters - -A, B, C... - -Cpdf.PageLabelStyle.LowercaseLetters - -a, b, c... - -Cpdf.addPageLabels(Cpdf.Pdf, Cpdf.PageLabelStyle, String, Int32, List{Int32}, -Boolean) - -Adds page labels. The prefix is prefix text for each label. The range is the -page range the labels apply to. Offset can be used to shift the numbering up or -down. - -Cpdf.removePageLabels(Cpdf.Pdf) - -Removes the page labels from the document. - -Cpdf.getPageLabelStringForPage(Cpdf.Pdf, Int32) - -Calculates the full label string for a given page, and returns it. - -Cpdf.startGetPageLabels(Cpdf.Pdf) - -Cpdf.getPageLabelStyle(Int32) - -Cpdf.getPageLabelPrefix(Int32) - -Cpdf.getPageLabelOffset(Int32) - -Cpdf.getPageLabelRange(Int32) - -Cpdf.endGetPageLabels +public String getPageLabelPrefix(int n) throws CpdfError; diff --git a/javasplits/c13.tex b/javasplits/c13.tex index 487cd7a..52e9730 100644 --- a/javasplits/c13.tex +++ b/javasplits/c13.tex @@ -1,47 +1,54 @@ -CHAPTER 12. File Attachments +/* CHAPTER 12. File Attachments */ -Cpdf.attachFile(String, Cpdf.Pdf) +/** Attaches a file to the PDF. It is attached at document level. +@param filename file name +@param pdf PDF document */ +public void attachFile(String filename, Pdf pdf) throws CpdfError; -Attaches a file to the pdf. It is attached at document level. +/** Attaches a file to a page of the PDF. Given its file name, pdf, and the +page number to which it should be attached. +@param filename file name +@param pdf PDF document +@param pagenumber page number to attach to */ +public void attachFileToPage(String filename, Pdf pdf, int pagenumber) + throws CpdfError; -Cpdf.attachFileToPage(String, Cpdf.Pdf, Int32) +/** Attaches data from memory to a document. +@param data attachment itself +@param filename file name to use to describe attachment +@param pdf PDF document */ +public void attachFileFromMemory(byte[] data, String filename, Pdf pdf) + throws CpdfError; -Attaches a file, given its file name, pdf, and the page number to which it -should be attached. +/** Attaches data to a page from memory. +@param data attachment itself +@param filename file name to use to describe attachment +@param pdf PDF document */ +public void attachFileToPageFromMemory(byte[] data, String filename, + Pdf pdf, int pagenumber) + throws CpdfError; -Cpdf.attachFileFromMemory(Byte[], String, Cpdf.Pdf) +/** Removes all page- and document-level attachments from a document. */ +public native void removeAttachedFiles(Pdf pdf) throws CpdfError; -Attaches data from memory, just like attachFile. +/** Lists information about attachments. Call +{@link #startGetAttachments(pdf) startGetAttachments} first, then {@link +#numberGetAttachments() numberGetAttachments} to find out how many there are. +Then {@link #getAttachmentName(int) getAttachmentName}, {@link +#getAttachmentPage(int) getAttachmentPage}, or {@link #getAttachmentData(int) +getAttachmentData}. to return each one 0...(n - 1). Finally, call +{@link #endGetAttachments() #endGetAttachments} to clean up. */ +public native void startGetAttachments(Pdf pdf) throws CpdfError; -Cpdf.attachFileToPageFromMemory(Byte[], String, Cpdf.Pdf, Int32) +public native int numberGetAttachments() throws CpdfError; -Attaches to a page from memory, just like attachFileToPage. +/** Gets the name of an attachment, given a serial number. */ +public native String getAttachmentName(int serial) throws CpdfError; -Cpdf.removeAttachedFiles(Cpdf.Pdf) +/** Gets the page number, given a serial number. 0 = document level. */ +public native int getAttachmentPage(int serial) throws CpdfError; -Removes all page- and document-level attachments from a document. +/** Gets the attachment data itself, given a serial number. */ +public native byte[] getAttachmentData(int serial) throws CpdfError; -Cpdf.startGetAttachments(Cpdf.Pdf) - -Cpdf.numberGetAttachments - -Lists information about attachments. Call startGetAttachments(pdf) first, then -numberGetAttachments to find out how many there are. Then getAttachmentName -etc. to return each one 0...(n - 1). Finally, call endGetAttachments to clean -up. - -Cpdf.getAttachmentName(Int32) - -Gets the name of an attachment. - -Cpdf.getAttachmentPage(Int32) - -Gets the page number. 0 = document level. - -Cpdf.getAttachmentData(Int32) - -Gets the attachment data itself. - -Cpdf.endGetAttachments - -Cleans up after getting attachments. +public native void endGetAttachments() throws CpdfError; diff --git a/javasplits/c14.tex b/javasplits/c14.tex index f81eb99..e6f1342 100644 --- a/javasplits/c14.tex +++ b/javasplits/c14.tex @@ -1,25 +1,28 @@ -CHAPTER 13. Images. +/* CHAPTER 13. Images. */ -Cpdf.startGetImageResolution(Cpdf.Pdf, Double) +/** Gets image data, including resolution at all points of use. Call +{@link #startGetImageResolution(pdf, double) startGetImageResolution(pdf, +min_required_resolution)} to begin the process of obtaining data on all +image uses below min_required_resolution, returning the total +number. So, to return all image uses, specify a very high +min_required_resolution. Then, call the other functions giving +a serial number 0...n - 1, to retrieve the data. Finally, call +{@link #endGetImageResolution() endGetImageResolution} to clean up. */ +public native int startGetImageResolution(Pdf pdf, double res) + throws CpdfError; -Cpdf.getImageResolutionPageNumber(Int32) +public native int getImageResolutionPageNumber(int serial) + throws CpdfError; -Cpdf.getImageResolutionImageName(Int32) +public native String getImageResolutionImageName(int serial) + throws CpdfError; -Cpdf.getImageResolutionXPixels(Int32) +public native int getImageResolutionXPixels(int serial) throws CpdfError; -Cpdf.getImageResolutionYPixels(Int32) +public native int getImageResolutionYPixels(int serial) throws CpdfError; -Cpdf.getImageResolutionXRes(Int32) +public native double getImageResolutionXRes(int serial) throws CpdfError; -Cpdf.getImageResolutionYRes(Int32) +public native double getImageResolutionYRes(int serial) throws CpdfError; -Cpdf.endGetImageResolution - -Gets image data, including resolution at all points of use. Call -startGetImageResolution(pdf, min_required_resolution) will begin the -process of obtaining data on all image uses below min_required_resolution, -returning the total number. So, to return all image uses, specify a very -high min_required_resolution. Then, call the other functions giving a -serial number 0..n - 1, to retrieve the data. Finally, call -endGetImageResolution to clean up. +public native void endGetImageResolution() throws CpdfError; diff --git a/javasplits/c15.tex b/javasplits/c15.tex index 66073b8..90a4cae 100644 --- a/javasplits/c15.tex +++ b/javasplits/c15.tex @@ -1,30 +1,38 @@ -CHAPTER 14. Fonts. +/* CHAPTER 14. Fonts. */ -Cpdf.startGetFontInfo(Cpdf.Pdf) +/** Retrieves font information. First, call {@link #startGetFontInfo(Pdf) +startGetFontInfo}. Now call {@link #numberFonts() numberFonts} to return +the number of fonts. For each font, call one or more of +{@link #getFontPage(int) getFontPage}, {@link #getFontName(int) +getFontName}, {@link #getFontType(int) getFontType}, and +{@link #getFontEncoding(int) getFontEncoding} giving a serial number +0...n - 1 to return information. Finally, call +{@link #endGetFontInfo() endGetFontInfo} to clean up. */ +public native void startGetFontInfo(Pdf pdf) throws CpdfError; -Cpdf.numberFonts +public native int numberFonts() throws CpdfError; -Cpdf.getFontPage(Int32) +public native String getFontName(int serial) throws CpdfError; -Cpdf.getFontName(Int32) +public native int getFontPage(int serial) throws CpdfError; -Cpdf.getFontType(Int32) +public native String getFontType(int setial) throws CpdfError; -Cpdf.getFontEncoding(Int32) +public native String getFontEncoding(int serial) throws CpdfError; -Cpdf.endGetFontInfo +public native void endGetFontInfo() throws CpdfError; -Retrieves font information. First, call startGetFontInfo(pdf). Now call -numberFonts to return the number of fonts. For each font, call one or more of -getFontPage, getFontName, getFontType, and getFontEncoding giving a serial -number 0..n - 1 to return information. Finally, call endGetFontInfo to clean -up. +/** Removes all font data from a file. */ +public native void removeFonts(Pdf pdf) throws CpdfError; -Cpdf.removeFonts(Cpdf.Pdf) - -Removes all font data from a file. - -Cpdf.copyFont(Cpdf.Pdf, Cpdf.Pdf, List{Int32}, Int32, String) - -Copies the given font from the given page in the 'from' PDF to every page in -the 'to' PDF. The new font is stored under its font name. +/** Copies the given font +from the given page in the 'from' PDF to every page in the 'to' PDF. The +new font is stored under its font name. +@param from_pdf PDF document to copy from +@param to_pdf PDF document to copy to +@param range page range +@param pagenumber page number of the page to copy from +@param fontname font name */ +public native void copyFont(Pdf from_pdf, Pdf to_pdf, Range range, + int pagenumber, String fontname) + throws CpdfError; diff --git a/javasplits/c16.tex b/javasplits/c16.tex index 7129ff2..cbcd4f8 100644 --- a/javasplits/c16.tex +++ b/javasplits/c16.tex @@ -1,19 +1,28 @@ -CHAPTER 15. PDF and JSON +/* CHAPTER 15. PDF and JSON */ -Cpdf.outputJSON(String, Boolean, Boolean, Boolean, Cpdf.Pdf) +/** Outputs a PDF in JSON format to the given filename. +@param filename file name +@param parse_content parse page content +@param no_stream_data all stream data is suppressed entirely +@param decompress_streams streams are decompressed +@param pdf PDF document */ +public void outputJSON(String filename, boolean parse_content, + boolean no_stream_data, boolean decompress_streams, + Pdf pdf) + throws CpdfError; -Outputs a PDF in JSON format to the given filename. If parse_content is true, -page content is parsed. If no_stream_data is true, all stream data is -suppressed entirely. +/** Like outputJSON, but it writes to a byte array in memory. +@param pdf PDF document +@param parse_content parse page content +@param no_stream_data all stream data is suppressed entirely +@param decompress_streams streams are decompressed */ +public native byte[] outputJSONMemory(Pdf pdf, boolean parse_content, + boolean no_stream_data, + boolean decompress_streams) + throws CpdfError; -Cpdf.outputJSONMemory(Cpdf.Pdf, Boolean, Boolean, Boolean) +/** Loads a PDF from a JSON file given its filename. */ +public Pdf fromJSON(String filename) throws CpdfError; -Like outputJSON, but it writes to a byte array in memory. - -Cpdf.fromJSON(String) - -Loads a PDF from a JSON file given its filename. - -Cpdf.fromJSONMemory(Byte[]) - -Loads a PDF from a JSON file in memory +/** Loads a PDF from a JSON file in memory. */ +public native Pdf fromJSONMemory(byte[] data) throws CpdfError; diff --git a/javasplits/c17.tex b/javasplits/c17.tex index 9e5be3c..4962e65 100644 --- a/javasplits/c17.tex +++ b/javasplits/c17.tex @@ -1,28 +1,28 @@ -CHAPTER 16. Optional Content Groups +/* CHAPTER 16. Optional Content Groups */ -Cpdf.startGetOCGList(Cpdf.Pdf) +/** Begins retrieving optional content group names. The serial number +0..n - 1 is returned. */ +public native int startGetOCGList(Pdf pdf) throws CpdfError; -Begins retrieving optional content group names. The serial number 0..n - 1 is -returned. +/** Retrieves an entry in the optional content group list, given the serial +number 0..n - 1. */ +public native String OCGListEntry(int serial) throws CpdfError; -Cpdf.OCGListEntry(Int32) +/** Ends retrieval of optional content group names. */ +public native void endGetOCGList() throws CpdfError; -Retrieves an OCG name, given its serial number 0..n - 1. +/** Renames an optional content group. +@param pdf PDF document +@param f name to rename from +@param t name to rename to */ +public native void OCGRename(Pdf pdf, String f, String t) throws CpdfError; -Cpdf.endGetOCGList +/** Ensures that every optional content group appears in the OCG order +list. */ +public native void OCGOrderAll(Pdf pdf) throws CpdfError; -Ends retrieval of optional content group names. - -Cpdf.OCGRename(Cpdf.Pdf, String, String) - -Renames an optional content group. - -Cpdf.OCGOrderAll(Cpdf.Pdf) - -Ensures that every optional content group appears in the OCG order list. - -Cpdf.OCGCoalesce(Cpdf.Pdf) - -Coalesces optional content groups. For example, if we merge or stamp two files -both with an OCG called "Layer 1", we will have two different optional content -groups. This function will merge the two into a single optional content group. +/** Coalesces optional content groups. For example, if we merge or stamp +two files both with an OCG called "Layer 1", we will have two different +optional content groups. This function will merge the two into a single +optional content group. */ +public native void OCGCoalesce(Pdf pdf) throws CpdfError; diff --git a/javasplits/c18.tex b/javasplits/c18.tex index 043b0ec..b3229e5 100644 --- a/javasplits/c18.tex +++ b/javasplits/c18.tex @@ -1,20 +1,36 @@ -CHAPTER 17. Creating New PDFs +/* CHAPTER 17. Creating New PDFs */ -Cpdf.blankDocument(Double, Double, Int32) +/** Creates a blank document with pages of the given width (in points), +height (in points), and number of pages. +@param w width of page +@param h height of page +@param pages number of pages */ +public native Pdf blankDocument(double w, double h, int pages) + throws CpdfError; -Creates a blank document with pages of the given width (in points), height (in -points), and number of pages. +/** Makes a blank document given a page size and number of pages. +@param papersize paper size, such as {@link #a0portrait a0portrait} +@param pages number of pages */ +public native Pdf blankDocumentPaper(int papersize, int pages) + throws CpdfError; -Cpdf.blankDocumentPaper(Cpdf.Papersize, Int32) +/** Typesets a UTF8 text file ragged right on a page of size w * h in +points in the given font and font size. +@param w width of page +@param h height of page +@param font font, such as {@link #timesRoman timesRoman} +@param fontsize font size +@param filename file name */ +public Pdf textToPDF(double w, double h, int font, double fontsize, + String filename) + throws CpdfError; -Makes a blank document given a page size and number of pages. - -Cpdf.textToPDF(Double, Double, Cpdf.Font, Double, String) - -Typesets a UTF8 text file ragged right on a page of size w * h in points in the -given font and font size. - -Cpdf.textToPDFPaper(Cpdf.Papersize, Cpdf.Font, Double, String) - -Typesets a UTF8 text file ragged right on a page of the given size in the given -font and font size. +/** Typesets a UTF8 text file ragged right on a page of the given size in +the given font and font size. +@param papersize paper size, such as {@link #a0portrait a0portrait} +@param font font, such as {@link #timesRoman timesRoman} +@param fontsize font size +@param filename file name */ +public Pdf textToPDFPaper(int papersize, int font, double fontsize, + String filename) + throws CpdfError; diff --git a/javasplits/c19.tex b/javasplits/c19.tex index a7d58f9..0c9a8cc 100644 --- a/javasplits/c19.tex +++ b/javasplits/c19.tex @@ -1,70 +1,91 @@ -CHAPTER 18. Miscellaneous +/* CHAPTER 18. Miscellaneous */ -Cpdf.draft(Cpdf.Pdf, List{Int32}, Boolean) +/** Removes images on the given pages, replacing them with crossed boxes if +boxes is true. +@param pdf PDF document +@param range page range +@param boxes add crossed boxes */ +public native void draft(Pdf pdf, Range range, boolean boxes) + throws CpdfError; -Removes images on the given pages, replacing them with crossed boxes if 'boxes' -is true. +/** Removes all text from the given pages in a given document. */ +public native void removeAllText(Pdf pdf, Range range) throws CpdfError; -Cpdf.removeAllText(Cpdf.Pdf, List{Int32}) +/** Blackens all text on the given pages. */ +public native void blackText(Pdf pdf, Range range) throws CpdfError; -Removes all text from the given pages in a given document. +/** Blackens all lines on the given pages. */ +public native void blackLines(Pdf pdf, Range range) throws CpdfError; -Cpdf.blackText(Cpdf.Pdf, List{Int32}) +/** Blackens all fills on the given pages. */ +public native void blackFills(Pdf pdf, Range range) throws CpdfError; -Blackens all text on the given pages. +/** Thickens every line less than min_thickness to +min_thickness. Thickness given in points. +@param pdf PDF document +@param range page range +@param min_thickness minimum thickness */ +public native void thinLines(Pdf pdf, Range range, double min_thickness) + throws CpdfError; -Cpdf.blackLines(Cpdf.Pdf, List{Int32}) +/** Copies the /ID from one document to another. +@param pdf PDF document to copy from +@param pdf2 PDF document to copy to */ +public native void copyId(Pdf pdf, Pdf pdf2) throws CpdfError; -Blackens all lines on the given pages. +/** Removes a document's /ID. */ +public native void removeId(Pdf pdf) throws CpdfError; -Cpdf.blackFills(Cpdf.Pdf, List{Int32}) +/** Sets the minor version number of a document. +@param pdf PDF document +@param version minor version number */ +public native void setVersion(Pdf pdf, int version) throws CpdfError; -Blackens all fills on the given pages. +/** Sets the full version number of a document. +@param pdf PDF document +@param major major version number +@param minor minor version nuber */ +public native void setFullVersion(Pdf pdf, int major, int minor) + throws CpdfError; -Cpdf.thinLines(Cpdf.Pdf, List{Int32}, Double) +/** Removes any dictionary entry with the given key anywhere in the +document. +@param pdf PDF document +@param key key to remove */ +public native void removeDictEntry(Pdf pdf, String key) throws CpdfError; -Thickens every line less than min_thickness to min_thickness. Thickness given -in points. +/** Removes any dictionary entry with the given key whose value matches the +given search term. +@param pdf PDF document +@param key key to remove +@param searchterm search term */ +public native void removeDictEntrySearch(Pdf pdf, String key, + String searchterm) + throws CpdfError; -Cpdf.copyId(Cpdf.Pdf, Cpdf.Pdf) +/** Replaces the value associated with the given key. +@param pdf PDF document +@param key key whose value to replace +@param newvalue value to replace with */ +public native void replaceDictEntry(Pdf pdf, String key, String newvalue) + throws CpdfError; -Copies the /ID from one document to another. +/** Replaces the value associated with the given key if the existing value +matches the search term. +@param pdf PDF document +@param key key whose value to replace +@param newvalue value to replace with +@param searchterm search term */ +public native void replaceDictEntrySearch(Pdf pdf, String key, + String newvalue, + String searchterm) + throws CpdfError; -Cpdf.removeId(Cpdf.Pdf) +/** Removes all clipping from pages in the given range. */ +public native void removeClipping(Pdf pdf, Range range) throws CpdfError; -Removes a document's /ID. - -Cpdf.setVersion(Cpdf.Pdf, Int32) - -Sets the minor version number of a document. - -Cpdf.setFullVersion(Cpdf.Pdf, Int32, Int32) - -Sets the full version number of a document. - -Cpdf.removeDictEntry(Cpdf.Pdf, String) - -Removes any dictionary entry with the given key anywhere in the document. - -Cpdf.removeDictEntrySearch(Cpdf.Pdf, String, String) - -Removes any dictionary entry with the given key whose value matches the given -search term. - -Cpdf.replaceDictEntry(Cpdf.Pdf, String, String) - -Replaces the value associated with the given key. - -Cpdf.replaceDictEntrySearch(Cpdf.Pdf, String, String, String) - -Replaces the value associated with the given key if the existing value matches -the search term. - -Cpdf.removeClipping(Cpdf.Pdf, List{Int32}) - -Removes all clipping from pages in the given range. - -Cpdf.getDictEntries(Cpdf.Pdf, String) - -Returns a JSON array containing any and all values associated with the given -key, and fills in its length. +/** Returns a JSON array containing any and all values associated with +the given key, and fills in its length. +@param pdf PDF document +@param key key to search for */ +public native byte[] getDictEntries(Pdf pdf, String key) throws CpdfError; diff --git a/javasplits/cm1.tex b/javasplits/cm1.tex index 805adc2..9f6e706 100644 --- a/javasplits/cm1.tex +++ b/javasplits/cm1.tex @@ -1,28 +1,32 @@ -CPDF .NET Library -================= +Jcpdf: Java interface to the cpdf PDF tools +=========================================== + +The DLLs "libcpdf" and "libjcpdf" are required. Before using the library, you must make sure your project or build environment -has access to the cpdf DLL, which is not part of the .NET assembly. You can add -it to a Visual Studio project as a file, set to copy-to-output-folder. Or, you -can install it in a standard location. The DLL must be named as follows, for -.NET to be able to find it: +has access to the cpdf DLL, which is not part of the Java .jar. You can add as +am external requirement in your Java IDE. Or, you can install it in a standard +location, such as the Windows system folder. -Windows: cpdf.dll -MacOS: libcpdf.dylib -Linux: libcpdf.so +On Windows, The DLL libcpdf.dll must be renamed to cpdf.dll, for Jcpdf to be +able to find it. -The following documentation is automatically extracted from the XML comments -present in the assembly. You can use Intellisense to view them within Visual -Studio - the documentation here is for completeness. +Follow the instructions at the end of Chapter 1 to write your first program. In +addition, the Jcpdf package provides documentation with each function, which +you can view in your IDE. -A 'range' is a list of integers specifying page numbers. +Usage +----- -Text arguments and results are in UTF8. Data is of type bytes[]. +Create an instance of the library with, for example: -Any function may raise the exception CPDFError, carrying a string describing -the error. +Jcpdf.jcpdf = new Jcpdf() -There is no automatic garbage collection of PDFs. Use the Using keyword and/or -the Dispose method on objects of type Cpdf.Pdf to explicitly deallocate PDFs. +You must call startup() to initialise the library prior to calling any other +function. +PDFs are of type Jcpdf.Pdf. Page ranges are of type Jcpdf.Range. Both PDFs and +ranges are not automatically garbage-collected. Use try or the close() method +to dispose of them. +Exceptions are of type Jcpdf.CpdfError and may be raised by any function.