mirror of
				https://github.com/johnwhitington/cpdf-source.git
				synced 2025-06-05 22:09:39 +02:00 
			
		
		
		
	more
This commit is contained in:
		
							
								
								
									
										2
									
								
								Makefile
									
									
									
									
									
								
							
							
						
						
									
										2
									
								
								Makefile
									
									
									
									
									
								
							| @@ -23,7 +23,7 @@ all : native-code native-code-library byte-code-library top htdoc | |||||||
|  |  | ||||||
| clean :: | clean :: | ||||||
| 	rm -rf doc foo foo2 out.pdf out2.pdf foo.pdf decomp.pdf *.cmt *.cmti \ | 	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 \ | DOC_FILES = cpdfunicodedata.mli cpdferror.mli cpdfdebug.mli cpdfjson.mli \ | ||||||
|             cpdfstrftime.mli cpdfcoord.mli cpdfattach.mli cpdfpagespec.mli \ |             cpdfstrftime.mli cpdfcoord.mli cpdfattach.mli cpdfpagespec.mli \ | ||||||
|   | |||||||
							
								
								
									
										
											BIN
										
									
								
								cpdfmanual.pdf
									
									
									
									
									
								
							
							
						
						
									
										
											BIN
										
									
								
								cpdfmanual.pdf
									
									
									
									
									
								
							
										
											Binary file not shown.
										
									
								
							| @@ -4,7 +4,7 @@ | |||||||
| \excludecomment{cpdflib} | \excludecomment{cpdflib} | ||||||
| \excludecomment{pycpdflib} | \excludecomment{pycpdflib} | ||||||
| \excludecomment{dotnetcpdflib} | \excludecomment{dotnetcpdflib} | ||||||
| \excludecomment{jcpdflib} | \includecomment{jcpdflib} | ||||||
| \usepackage{palatino} | \usepackage{palatino} | ||||||
| \usepackage{listings} | \usepackage{listings} | ||||||
| \usepackage{microtype} | \usepackage{microtype} | ||||||
| @@ -1059,9 +1059,10 @@ Use the \texttt{-no-embed-font} to avoid embedding the Standard 14 Font metrics | |||||||
|  |  | ||||||
| \begin{jcpdflib} | \begin{jcpdflib} | ||||||
| \clearpage | \clearpage | ||||||
| \section*{.NET Interface} | \section*{Java Interface} | ||||||
| \begin{small}\tt | \begin{small}\tt | ||||||
| \lstinputlisting{javasplits/cm1} | \lstinputlisting{javasplits/cm1} | ||||||
|  | \lstinputlisting{javasplits/c00} | ||||||
| \lstinputlisting{javasplits/c01} | \lstinputlisting{javasplits/c01} | ||||||
| \lstinputlisting{javasplits/c02} | \lstinputlisting{javasplits/c02} | ||||||
| \end{small} | \end{small} | ||||||
|   | |||||||
| @@ -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 | /** Page label style: 1, 2, 3... */ | ||||||
| deallocated. | 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 | /** Position anchor: absolute centre. Takes two numbers, x and y. */ | ||||||
|  | public static int posCentre = 0; | ||||||
| Any function in this library may raise the CPDFError exception. | /** Position anchor: absolute left. Takes two numbers, x and y. */ | ||||||
|  | public static int posLeft = 1; | ||||||
| Cpdf.CPDFError.#ctor(String) | /** Position anchor: absolute right. Takes two numbers, x and y. */ | ||||||
|  | public static int posRight = 2; | ||||||
| Construct a CPDFError which carries a string. | /** 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; | ||||||
|   | |||||||
| @@ -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 | /** Prints some information about | ||||||
|  | resource usage. This can be used to detect if PDFs or ranges are being | ||||||
| Some operations have a fast mode. The default is 'slow' mode, which works even | deallocated properly. Contrary to its name, it may be run at any time. */ | ||||||
| on old-fashioned files. For more details, see section 1.13 of the CPDF manual. | public native void onExit(); | ||||||
| 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. |  | ||||||
|   | |||||||
| @@ -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 | @param filename file name | ||||||
| case the file is encrypted. It won't be decrypted, but sometimes the password | @param userpw user password */ | ||||||
| is needed just to load the file. | 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 | @param data byte array containing the PDF file | ||||||
| and parsed when they are actually needed. Use this when the whole file won't be | @param userpw user password */ | ||||||
| required. Also supply a user password (possibly blank) in case the file is | public Pdf fromMemory(byte[] data, String userpw) throws CpdfError; | ||||||
| encrypted. It won't be decrypted, but sometimes the password is needed just to |  | ||||||
| load the file. |  | ||||||
|  |  | ||||||
| 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 | ||||||
|  | <code>{@link #fromMemoryLazy(byte[], String) fromMemoryLazy}</code> | ||||||
|  | @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, | <p>To enumerate the list of currently allocated PDFs, call | ||||||
| but lazily like fromFileLazy. The caller must use AllocHGlobal / Marshal.Copy / | {@link #startEnumeratePDFs() startEnumeratePDFs} which gives the number,  | ||||||
| FreeHGlobal itself. It must not free the memory until the PDF is also gone. | <code>n</code>, of PDFs allocated, then {@link #enumeratePDFsInfo(int) | ||||||
|  | enumeratePDFsInfo} and {@link #enumeratePDFsKey(int) enumeratePDFsKey} with | ||||||
|  | index numbers from <code>0...(n - 1)</code>. 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) | /** Returns the info for a given PDF number. */ | ||||||
|  | public native String enumeratePDFsInfo(int n) throws CpdfError; | ||||||
| Cpdf.enumeratePDFsInfo(Int32) |  | ||||||
|  | /** Ends enumeration of currently allocated PDFs. */ | ||||||
| Cpdf.endEnumeratePDFs | public native void endEnumeratePDFs() throws CpdfError; | ||||||
|  |  | ||||||
| To enumerate the list of currently allocated PDFs, call startEnumeratePDFs | /** Converts a figure in centimetres to points. (72 points to 1 inch) */ | ||||||
| which gives the number, n, of PDFs allocated, then enumeratePDFsInfo and | public native double ptOfCm(double f) throws CpdfError; | ||||||
| enumeratePDFsKey with index numbers from 0...(n - 1). Call endEnumeratePDFs to |  | ||||||
| clean up. | /** Converts a figure in millimetres to points. (72 points to 1 inch) */ | ||||||
|  | public native double ptOfMm(double f) throws CpdfError; | ||||||
| Cpdf.ptOfCm(Double) |  | ||||||
|  | /** Converts a figure in inches to points (72. points to 1 inch) */ | ||||||
| Converts a figure in centimetres to points (72 points to 1 inch) | public native double ptOfIn(double f) throws CpdfError; | ||||||
|  |  | ||||||
| Cpdf.ptOfMm(Double) | /** Converts a figure in points to centimetres. (72 points to 1 inch) */ | ||||||
|  | public native double cmOfPt(double f) throws CpdfError; | ||||||
| Converts a figure in millimetres to points (72 points to 1 inch) |  | ||||||
|  | /** Converts a figure in points to millimetres. (72 points to 1 inch) */ | ||||||
| Cpdf.ptOfIn(Double) | public native double mmOfPt(double f) throws CpdfError; | ||||||
|  |  | ||||||
| Converts a figure in inches to points (72 points to 1 inch) | /** Converts a figure in points to millimetres. (72 points to 1 inch) */ | ||||||
|  | public native double inOfPt(double f) throws CpdfError; | ||||||
| Cpdf.cmOfPt(Double) |  | ||||||
|  | /** Parses a page specification such as <code>1,2,6-end</code> with | ||||||
| Converts a figure in points to centimetres (72 points to 1 inch) | reference to a given PDF. (The PDF is supplied so that page ranges which | ||||||
|  | reference pages which do not exist are rejected). | ||||||
| Cpdf.mmOfPt(Double) |  | ||||||
|  | @param pdf PDF document | ||||||
| Converts a figure in points to millimetres (72 points to 1 inch) | @param pagespec page specification */ | ||||||
|  | public native Range parsePagespec(Pdf pdf, String pagespec) | ||||||
| Cpdf.inOfPt(Double) |     throws CpdfError; | ||||||
|  |  | ||||||
| Converts a figure in points to inches (72 points to 1 inch) | /** Validates a page specification so far as is possible in the absence of | ||||||
|  | the actual document. Result is <code>true</code> if valid. */ | ||||||
| Cpdf.parsePagespec(Cpdf.Pdf, String) | public native boolean validatePagespec(String pagespec) throws CpdfError; | ||||||
|  |  | ||||||
| Parses a page specification with reference to a given PDF (the PDF is supplied | /** Builds a page specification from a page range. For example, the range | ||||||
| so that page ranges which reference pages which do not exist are rejected). | containing 1,2,3,6,7,8 in a document of 8 pages might yield | ||||||
|  | <code>"1-3,6-end"</code> | ||||||
| Cpdf.validatePagespec(String) |  | ||||||
|  | @param pdf PDF document | ||||||
| Validates a page specification so far as is possible in the absence of the | @param r page range | ||||||
| actual document. Result is true if valid. | */ | ||||||
|  | public String stringOfPagespec(Pdf pdf, Range r) throws CpdfError; | ||||||
| Cpdf.stringOfPagespec(Cpdf.Pdf, List{Int32}) |  | ||||||
|  | /** The range containing no pages. */ | ||||||
| Builds a page specification from a page range. For example, the range | public native Range blankRange() throws CpdfError; | ||||||
| containing 1, 2, 3, 6, 7, 8 in a document of 8 pages might yield "1-3, 6-end" |  | ||||||
|  | /** The page range containing all page numbers from one page number to | ||||||
| Cpdf.blankRange | another. | ||||||
|  | @param from page number to begin at (inclusive) | ||||||
| Creates a range with no pages in. | @param to page number to end at (inclusive) */ | ||||||
|  | public native Range range(int from, int to) throws CpdfError; | ||||||
| Cpdf.range(Int32, Int32) |  | ||||||
|  | /** The page range contaning all pages in a given document. */ | ||||||
| Builds a range from one page to another inclusive. For example, range(3, 7) | public native Range all(Pdf pdf) throws CpdfError; | ||||||
| gives the range 3, 4, 5, 6, 7 |  | ||||||
|  | /** The page range containing all odd-numbered pages from an existing | ||||||
| Cpdf.all(Cpdf.Pdf) | range. */ | ||||||
|  | public native Range odd(Range r) throws CpdfError; | ||||||
| The range containing all the pages in a given document. |  | ||||||
|  | /** The page range containing all even-numbered pages from an existing | ||||||
| Cpdf.even(List{Int32}) | range. */ | ||||||
|  | public native Range even(Range r) throws CpdfError; | ||||||
| Makes a range which contains just the even pages of another range. |  | ||||||
|  | /** The union of two ranges - all those pages in either. */ | ||||||
| Cpdf.odd(List{Int32}) | public native Range rangeUnion(Range r, Range s) throws CpdfError; | ||||||
|  |  | ||||||
| Makes a range which contains just the odd pages of another range. | /** The range containing all pages in the first given range which are not | ||||||
|  | in the second. */ | ||||||
| Cpdf.rangeUnion(List{Int32}, List{Int32}) | public native Range difference(Range r, Range s) throws CpdfError; | ||||||
|  |  | ||||||
| Makes the union of two ranges giving a range containing the pages in range a | /** Remove duplicates from a range, returning a new one. */ | ||||||
| and range b. | public native Range removeDuplicates(Range r) throws CpdfError; | ||||||
|  |  | ||||||
| Cpdf.difference(List{Int32}, List{Int32}) | /** The length of a range. */ | ||||||
|  | public native int rangeLength(Range r) throws CpdfError; | ||||||
| Makes the difference of two ranges, giving a range containing all the pages in |  | ||||||
| a except for those which are also in b. | /** Gets a page number from a range at the given offset. */ | ||||||
|  | public native int rangeGet(Range r, int n) throws CpdfError; | ||||||
| Cpdf.removeDuplicates(List{Int32}) |  | ||||||
|  | /** Adds a page number to a range, returning a new one. */ | ||||||
| Deduplicates a range, making a new one. | public native Range rangeAdd(Range r, int n) throws CpdfError; | ||||||
|  |  | ||||||
| Cpdf.rangeLength(List{Int32}) | /** Tests to see if a given number is in a page range. */ | ||||||
|  | public native boolean isInRange(Range r, int n) throws CpdfError; | ||||||
| Gives the number of pages in a range. |  | ||||||
|  | /** Returns the number of pages in a PDF. */ | ||||||
| Cpdf.rangeGet(List{Int32}, Int32) | public native int pages(Pdf pdf) throws CpdfError; | ||||||
|  |  | ||||||
| Gets the page number at position n in a range,  | /** Returns the number of pages in a given | ||||||
| where n runs from 0 to rangeLength - 1. | PDF, with given user password. It tries to do this as fast as | ||||||
|  | possible, without loading the whole file. | ||||||
| Cpdf.rangeAdd(List{Int32}, Int32) | @param userpw user password | ||||||
|  | @param filename file name */ | ||||||
| Adds the page to a range, if it is not already | public int pagesFast(String userpw, String filename) throws CpdfError; | ||||||
| there. |  | ||||||
|  | /** Writes the PDF document to a given filename. If <code>linearize</code> | ||||||
| Cpdf.isInRange(List{Int32}, Int32) | is <code>true</code>, it will be linearized if a linearizer is available. | ||||||
|  | If <code>make_id</code> is <code>true</code>, it will be given a new ID. | ||||||
| Returns true if the page is in the range,  | @param pdf PDF document | ||||||
| false otherwise. | @param filename file name | ||||||
|  | @param linearize linearize | ||||||
| Cpdf.pages(Cpdf.Pdf) | @param make_id make new ID | ||||||
|  | */ | ||||||
| Returns the number of pages in a PDF. | public void toFile(Pdf pdf, String filename, boolean linearize, | ||||||
|  |                    boolean make_id) | ||||||
| Cpdf.pagesFast(String, String) |     throws CpdfError; | ||||||
|  |  | ||||||
| Returns the number of pages in a given PDF, with given user password. It tries | /** Writes the PDF document to a given filename, with extra parameters. If | ||||||
| to do this as fast as possible, without loading the whole file. | <code>make_id</code> is true, it will be given a new ID. If | ||||||
|  | <code>preserve_objstm</code> is true, existing object streams will be | ||||||
| Cpdf.toFile(Cpdf.Pdf, String, Boolean, Boolean) | preserved. If <code>generate_objstm</code> is true, object streams will be | ||||||
|  | generated even if not originally present. If <code>compress_objstm</code> | ||||||
| Writes the file to a given filename. If linearize is true, it will be | is true, object streams will be compressed (what we usually want). | ||||||
| linearized if a linearizer is available. If make_id is true, it will be given a | WARNING: the pdf argument will be invalid after this call, and should not | ||||||
| new ID. | be used again. | ||||||
|  | @param pdf PDF document | ||||||
| Cpdf.toFileExt(Cpdf.Pdf, String, Boolean, Boolean, Boolean, Boolean, Boolean) | @param filename file name | ||||||
|  | @param linearize linearize | ||||||
| Writes the file to a given filename. If make_id is true, it will be given a new | @param make_id make new ID | ||||||
| ID.  If preserve_objstm is true, existing object streams will be preserved. If | @param preserve_objstm preserve object streams | ||||||
| generate_objstm is true, object streams will be generated even if not | @param create_objstm create new object streams | ||||||
| originally present. If compress_objstm is true, object streams will be | @param compress_objstm compress object streams | ||||||
| compressed (what we usually want). WARNING: the pdf argument will be invalid | */ | ||||||
| after this call, and should be not be used again. | public void toFileExt(Pdf pdf, String filename, boolean linearize, | ||||||
|  |                       boolean make_id, boolean preserve_objstm, | ||||||
| Cpdf.toMemory(Cpdf.Pdf, Boolean, Boolean) |                       boolean create_objstm, boolean compress_objstm) | ||||||
|  |     throws CpdfError; | ||||||
| Writes a PDF file and returns as an array of bytes. |  | ||||||
|  | /** Writes a PDF document and returns it as an array of bytes. | ||||||
| Cpdf.isEncrypted(Cpdf.Pdf) | @param pdf PDF document | ||||||
|  | @param linearize linearize | ||||||
| Returns true if a documented is encrypted, false otherwise. | @param make_id make new ID | ||||||
|  | */ | ||||||
| Cpdf.decryptPdf(Cpdf.Pdf, String) | public native byte[] toMemory(Pdf pdf, boolean linearize, boolean make_id) | ||||||
|  |     throws CpdfError; | ||||||
| Attempts to decrypt a PDF using the given user password. An exception is raised |  | ||||||
| if the decryption fails. | /** Returns <code>true</code> if a document is encrypted, | ||||||
|  | <code>false</code> otherwise. */ | ||||||
| Cpdf.decryptPdfOwner(Cpdf.Pdf, String) | public native boolean isEncrypted(Pdf pdf) throws CpdfError; | ||||||
|  |  | ||||||
| Attempts to decrypt a PDF using the given owner password. Raises an exception | /** Attempts to decrypt a PDF using the given | ||||||
| if the decryption fails. | user password. An exception is raised if the decryption fails. | ||||||
|  | @param pdf PDF document | ||||||
| Cpdf.Permission | @param userpw user password */ | ||||||
|  | public void decryptPdf(Pdf pdf, String userpw) throws CpdfError; | ||||||
| Permissions |  | ||||||
|  | /** Attempts to decrypt a PDF using the given owner password. Raises an | ||||||
| Cpdf.Permission.NoEdit | exception if the decryption fails. | ||||||
|  | @param pdf PDF document | ||||||
| Cannot edit the document | @param ownerpw owner password */ | ||||||
|  | public void decryptPdfOwner(Pdf pdf, String ownerpw) throws CpdfError; | ||||||
| Cpdf.Permission.NoPrint |  | ||||||
|  | /** Writes a PDF document as encrypted. The encryption method and | ||||||
| Cannot print the document | permissions are drawn from Jcpdf's fields, documented above. | ||||||
|  | @param pdf PDF document | ||||||
| Cpdf.Permission.NoCopy | @param encryption_method encryption method, e.g | ||||||
|  |   {@link #aes256bitisofalse aes256bitisofalse}  | ||||||
| Cannot copy the document | @param permissions array of permissions e.g {@link #noEdit noEdit} | ||||||
|  | @param owner_password owner password | ||||||
| Cpdf.Permission.NoAnnot | @param user_password user password | ||||||
|  | @param linearize linearize | ||||||
| Cannot annotate the document | @param makeid make new ID | ||||||
|  | @param filename file name */ | ||||||
| Cpdf.Permission.NoForms | public void toFileEncrypted(Pdf pdf, int encryption_method, | ||||||
|  |                             int[] permissions, String owner_password, | ||||||
| Cannot edit forms in the document |                             String user_password, boolean linearize, | ||||||
|  |                             boolean makeid, String filename) | ||||||
| Cpdf.Permission.NoExtract |     throws CpdfError; | ||||||
|  |  | ||||||
| Cannot extract information | /** 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.Permission.NoAssemble |  | ||||||
|  | @param pdf PDF document | ||||||
| Cannot assemble into a bigger document | @param encryption_method encryption method, e.g | ||||||
|  |   {@link #aes256bitisofalse aes256bitisofalse}  | ||||||
| Cpdf.Permission.NoHqPrint | @param permissions array of permissions e.g {@link #noEdit noEdit} | ||||||
|  | @param owner_password owner password | ||||||
| Cannot print high quality | @param user_password user password | ||||||
|  | @param linearize linearize | ||||||
| Cpdf.EncryptionMethod | @param makeid make new ID | ||||||
|  | @param preserve_objstm preserve existing object streams | ||||||
| Encryption methods | @param generate_objstm generate new object streams | ||||||
|  | @param compress_objstm compress object streams | ||||||
| Cpdf.EncryptionMethod.Pdf40bit | @param filename file name */ | ||||||
|  | public void toFileEncryptedExt(Pdf pdf, int encryption_method, | ||||||
| 40 bit RC4 encryption |                                int[] permissions, String owner_password, | ||||||
|  |                                String user_password, boolean linearize, | ||||||
| Cpdf.EncryptionMethod.Pdf128bit |                                boolean makeid, boolean preserve_objstm, | ||||||
|  |                                boolean generate_objstm, | ||||||
| 128 bit RC4 encryption |                                boolean compress_objstm, String filename) | ||||||
|  |     throws CpdfError; | ||||||
| Cpdf.EncryptionMethod.Aes128bitfalse |  | ||||||
|  | /** Returns <code>true</code> if the given permission (restriction) such as | ||||||
| 128 bit AES encryption, do not encrypt metadata | {@link #noEdit noEdit} is present. */ | ||||||
|  | public native boolean hasPermission(Pdf pdf, int permission) | ||||||
| Cpdf.EncryptionMethod.Aes128bittrue |     throws CpdfError; | ||||||
|  |  | ||||||
| 128 bit AES encryption, encrypt metadata | /** Returns the encryption method currently in use on a document, such as | ||||||
|  | {@link #aes256bitisofalse aes256bitisofalse}. */ | ||||||
| Cpdf.EncryptionMethod.Aes256bitfalse | public native int encryptionKind(Pdf pdf) throws CpdfError; | ||||||
|  |  | ||||||
| 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. |  | ||||||
|   | |||||||
| @@ -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 <code>retain_numbering</code> is true page labels | ||||||
|  | are not rewritten. If <code>remove_duplicate_fonts</code> 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 | /** Returns a new document with just those pages in the page range. | ||||||
| remove_duplicate_fonts is true, duplicate fonts are merged. This is useful when |  *  @param pdf PDF document | ||||||
| the source documents for merging originate from the same source. |  *  @param range range*/ | ||||||
|  | public native Pdf selectPages(Pdf pdf, Range range) throws CpdfError; | ||||||
| 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. |  | ||||||
|   | |||||||
| @@ -1,235 +1,134 @@ | |||||||
| CHAPTER 3. Pages | /* 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 | ||||||
| Scales the page dimensions and content by the given scale, about (0, 0). Other | altered as appropriate). | ||||||
| boxes (crop etc. are altered as appropriate) | @param pdf PDF document | ||||||
|  | @param range page range | ||||||
| Cpdf.scaleToFit(Cpdf.Pdf, List{Int32}, Double, Double, Double) | @param sx X scale | ||||||
|  | @param sy Y scale*/ | ||||||
| Scales the content to fit new page dimensions (width x height) multiplied by | public native void scalePages(Pdf pdf, Range range, double sx, double sy) | ||||||
| scale (typically 1.0).  Other boxes (crop etc. are altered as appropriate) |     throws CpdfError; | ||||||
|  |  | ||||||
| Cpdf.Papersize | /** Scales the content to fit new page dimensions (width x height) | ||||||
|  | multiplied by scale (typically 1.0). Other boxes (crop etc. are altered as | ||||||
| Built-in paper sizes | appropriate). | ||||||
|  | @param pdf PDF document | ||||||
| Cpdf.Papersize.A0portrait | @param range page range | ||||||
|  | @param w width in points | ||||||
| A0 Portrait paper | @param h height in points | ||||||
|  | @param scale scale (typically 1.0) | ||||||
| Cpdf.Papersize.A1portrait | */ | ||||||
|  | public native void scaleToFit(Pdf pdf, Range range, double w, double h, | ||||||
| A1 Portrait paper |                               double scale) | ||||||
|  |     throws CpdfError; | ||||||
| Cpdf.Papersize.A2portrait |  | ||||||
|  | /** Scales the page content to fit the given page size, possibly multiplied | ||||||
| A2 Portrait paper | by scale (typically 1.0). | ||||||
|  | @param pdf PDF document | ||||||
| Cpdf.Papersize.A3portrait | @param range page range | ||||||
|  | @param papersize paper size, such as {@link #a4portrait a0portrait} | ||||||
| A3 Portrait paper | @param scale scale (typically 1.0) | ||||||
|  | */ | ||||||
| Cpdf.Papersize.A4portrait | public native void scaleToFitPaper(Pdf pdf, Range range, int papersize, | ||||||
|  |                                    double scale) | ||||||
| A4 Portrait paper |     throws CpdfError; | ||||||
|  |  | ||||||
| Cpdf.Papersize.A5portrait | /** Scales the contents of the pages in the range about the point given by | ||||||
|  | the <code>anchor</code>, <code>p1</code> and <code>p2</code> by the scale | ||||||
| A5 Portrait paper | given. See the documentation for the chosen anchor. | ||||||
|  | @param pdf PDF document | ||||||
| Cpdf.Papersize.A0landscape | @param range page range | ||||||
|  | @param anchor position anchor, such as {@link #posCentre posCentre} | ||||||
| A0 Landscape paper | @param p1 position parameter 1 | ||||||
|  | @param p2 position parameter 2 | ||||||
| Cpdf.Papersize.A1landscape | @param scale scale | ||||||
|  | */ | ||||||
| A1 Landscape paper | public native void scaleContents(Pdf pdf, Range range, int anchor, | ||||||
|  |                                  double p1, double p2, double scale) | ||||||
| Cpdf.Papersize.A2landscape |     throws CpdfError; | ||||||
|  |  | ||||||
| A2 Landscape paper | /** Shifts the content of the pages in the range. | ||||||
|  | @param pdf PDF document | ||||||
| Cpdf.Papersize.A3landscape | @param range page range | ||||||
|  | @param dx X shift | ||||||
| A3 Landscape paper | @param dy Y shift | ||||||
|  | */ | ||||||
| Cpdf.Papersize.A4landscape | public native void shiftContents(Pdf pdf, Range range, double dx, | ||||||
|  |                                  double dy) | ||||||
| A4 Landscape paper |     throws CpdfError; | ||||||
|  |  | ||||||
| Cpdf.Papersize.A5landscape | /** Changes the viewing rotation to an absolute value. Appropriate | ||||||
|  | rotations are 0, 90, 180, 270. | ||||||
| A5 Landscape paper | @param pdf PDF document | ||||||
|  | @param range page range | ||||||
| Cpdf.Papersize.Usletterportrait | @param angle viewing rotation | ||||||
|  | */ | ||||||
| US Letter Portrait paper | public native void rotate(Pdf pdf, Range range, int angle) | ||||||
|  |     throws CpdfError; | ||||||
| Cpdf.Papersize.Usletterlandscape |  | ||||||
|  | /** Changes the viewing rotation by a relative value. Appropriate | ||||||
| US Letter Landscape paper | rotations are 0, 90, 180, 270. | ||||||
|  | @param pdf PDF document | ||||||
| Cpdf.Papersize.Uslegalportrait | @param range page range | ||||||
|  | @param angle viewing rotation | ||||||
| US Legal Portrait paper | */ | ||||||
|  | public native void rotateBy(Pdf pdf, Range range, int angle) | ||||||
| Cpdf.Papersize.Uslegallandscape |     throws CpdfError; | ||||||
|  |  | ||||||
| US Legal Landscape paper | /** Rotates the content about the centre of the page by the given number of | ||||||
|  |  | ||||||
| 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 |  | ||||||
| degrees, in a clockwise direction. | 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 | /** Flips horizontally the pages in the range. */ | ||||||
| degrees, in a clockwise direction. | 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 | /** Crops a page, replacing any existing crop box. The dimensions are in | ||||||
| dimensions and content such that there is no visual change. | 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}) | /** Makes a given box a 'hard box' i.e clips it explicitly. | ||||||
|  | @param pdf PDF document | ||||||
| Removes any crop box from pages in the range. | @param range page range | ||||||
|  | @param box box name e.g "/CropBox" */ | ||||||
| Cpdf.removeTrim(Cpdf.Pdf, List{Int32}) | public native void hardBox(Pdf pdf, Range range, String box) | ||||||
|  |     throws CpdfError; | ||||||
| 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. |  | ||||||
|   | |||||||
| @@ -1,3 +1,2 @@ | |||||||
| CHAPTER 4. Encryption | /* CHAPTER 4. Encryption */ | ||||||
|  | /* Encryption covered under Chapter 1 in cpdflib. */ | ||||||
| Encryption covered in Chapter 1. |  | ||||||
|   | |||||||
| @@ -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) | /** Squeezes a pdf in memory. */ | ||||||
|  | public native void squeezeInMemory(Pdf pdf) throws CpdfError; | ||||||
| Decompresses any streams in the given PDF, so long as the compression method is |  | ||||||
| supported. |  | ||||||
|  |  | ||||||
| Cpdf.squeezeInMemory(Cpdf.Pdf) |  | ||||||
|  |  | ||||||
| Squeezes a pdf in memory. |  | ||||||
|   | |||||||
| @@ -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 | ||||||
|  | <code>0...(n - 1)</code>. */ | ||||||
|  | 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 <code>0...(n - 1)</code>. */ | ||||||
|  | public native int getBookmarkPage(Pdf pdf, int serial) throws CpdfError; | ||||||
|  |  | ||||||
| Cpdf.getBookmarkLevel(Int32) | /** Returns the text of bookmark <code>0...(n - 1))</code> */ | ||||||
|  | public String getBookmarkText(int serial) throws CpdfError; | ||||||
|  |  | ||||||
| Gets the bookmark level for the given bookmark (0...(n - 1)). | /** Returns <code>true</code> 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 | /** Starts the bookmark setting process for n bookmarks. */ | ||||||
| PDF passed to startSetBookmarkInfo) and bookmark (0...(n - 1)). | public native void startSetBookmarkInfo(int n) throws CpdfError; | ||||||
|  |  | ||||||
| Cpdf.getBookmarkText(Int32) | /** Set bookmark level for the given bookmark <code>0...(n - 1)</code>. */ | ||||||
|  | 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 <code>0...(n - 1)</code>. */ | ||||||
|  | public native void setBookmarkPage(Pdf pdf, int serial, int pagenum) | ||||||
|  |     throws CpdfError; | ||||||
|  |  | ||||||
| Cpdf.getBookmarkOpenStatus(Int32) | /** Sets the open status of bookmark <code>0...(n - 1)</code>. */ | ||||||
|  | public native void setBookmarkOpenStatus(int serial, boolean open) | ||||||
|  |     throws CpdfError; | ||||||
|  |  | ||||||
| True if the bookmark is open. | /** Sets the text of bookmark <code>0...(n - 1)</code>. */ | ||||||
|  | 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. | /** Typesets a table of contents from existing bookmarks and prepends it to | ||||||
|  | the document. | ||||||
| Cpdf.setBookmarkLevel(Int32, Int32) | @param pdf PDF document | ||||||
|  | @param font font, such as {@link #timesRoman timesRoman} | ||||||
| Set bookmark level for the given bookmark (0...(n - 1)). | @param fontsize font size | ||||||
|  | @param title table of contents title | ||||||
| Cpdf.setBookmarkPage(Cpdf.Pdf, Int32, Int32) | @param bookmark if <code>true</code>, the table of contents gets its own | ||||||
|  | bookmark. */ | ||||||
| Sets the bookmark target page for the given PDF (which must be the same as the | public void tableOfContents(Pdf pdf, int font, double fontsize, | ||||||
| PDF to be passed to endSetBookmarkInfo) and bookmark (0...(n - 1)). |                             String title, boolean bookmark) | ||||||
|  |     throws CpdfError; | ||||||
| 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. |  | ||||||
|   | |||||||
| @@ -1,3 +1,2 @@ | |||||||
| CHAPTER 7. Presentations | /* CHAPTER 7. Presentations */ | ||||||
|  | /* Not included in the library version. */ | ||||||
| Not included in the library version of cpdf. |  | ||||||
|   | |||||||
| @@ -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 | range. The stamp is placed with its origin at the origin of the target | ||||||
| document. | 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 <code>true</code>, <code>pdf</code> goes over | ||||||
|  | <code>pdf2</code> otherwise under | ||||||
|  | @param scale_stamp_to_fit if <code>true</code> 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 <code>true</code>, 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. | /** Combines the two PDFs page-by-page, putting each page of 'over' over | ||||||
| The stamp is placed with its origin at the origin of the target document. | each page of 'under'. */ | ||||||
|  | public native Pdf combinePages(Pdf under, Pdf over) throws CpdfError; | ||||||
|  |  | ||||||
| Cpdf.stampExtended(Cpdf.Pdf, Cpdf.Pdf, List{Int32}, Boolean, Boolean, | /** Adds text to the pages in the given range. | ||||||
| Cpdf.Position, Boolean) | @param metrics if <code>true</code>, 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 <code>true</code>, text goes under page | ||||||
|  | @param cropbox if <code>true</code>, | ||||||
|  | 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, | /** Adds text with most parameters default. | ||||||
| isover false, pdf goes under pdf2 - scale_stamp_to_fit scales the stamp to fit | @param pdf PDF document | ||||||
| the page - pos gives the position to put the stamp - relative_to_cropbox: if | @param range page range | ||||||
| true, pos is relative to cropbox not mediabox. | @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 | /** Returns the width of a given string in the given font in thousandths of | ||||||
| 'under'. | 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 <code>true</code> 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 | /** Stamps a PDF onto the pages in the given range in pdf as a shared Form | ||||||
|  |  | ||||||
| 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 |  | ||||||
| XObject. The name of the newly-created XObject is returned. | 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; | ||||||
|   | |||||||
| @@ -1,40 +1,44 @@ | |||||||
| CHAPTER 9. Multipage facilities | /* CHAPTER 9. Multipage facilities */ | ||||||
|  |  | ||||||
| Cpdf.impose(Cpdf.Pdf, Double, Double, Boolean, Boolean, Boolean, Boolean, | /** Imposes a PDF. | ||||||
| Boolean, Double, Double, Double) | @param pdf PDF document | ||||||
|  | @param x x parameter | ||||||
|  | @param y y parameter | ||||||
|  | @param fit <code>true</code>: impose to fit a page of size x by y; | ||||||
|  | <code>false</code>: 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 | /** Imposes a document two up. twoUp does so by shrinking the page size, to | ||||||
| of size x * y. This is controlled by fit. Columns imposes by columns rather | fit two pages on one. */ | ||||||
| than rows. rtl is right-to-left, btt bottom-to-top. Center is unused for now. | public native void twoUp(Pdf pdf) throws CpdfError; | ||||||
| Margin is the margin around the output, spacing the spacing between imposed |  | ||||||
| inputs. |  | ||||||
|  |  | ||||||
| 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 | /** Adds a blank page before each page in the given range. */ | ||||||
| two pages on one. | 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 | /** Adds a blank page after every n pages. */ | ||||||
| two pages on one. | 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. | /** Adds pages at the beginning to pad the file to a multiple of n pages in | ||||||
|  | length. */ | ||||||
| Cpdf.padAfter(Cpdf.Pdf, List{Int32}) | public native void padMultipleBefore(Pdf pdf, int n) throws CpdfError; | ||||||
|  |  | ||||||
| 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. |  | ||||||
|   | |||||||
| @@ -1,5 +1,4 @@ | |||||||
| CHAPTER 10. Annotations | /* CHAPTER 10. Annotations */ | ||||||
|  |  | ||||||
| Cpdf.annotationsJSON(Cpdf.Pdf) | /** Returns the annotations from a PDF in JSON format. */ | ||||||
|  | public native byte[] annotationsJSON(Pdf pdf) throws CpdfError; | ||||||
| Returns the annotations from a PDF in JSON format |  | ||||||
|   | |||||||
| @@ -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 | /** Returns the minor version number of a document. */ | ||||||
| it. | 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 <code>true</code> 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 <code>true</code> 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 <code>true</code>, 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@, | /** Calculates the full label string for a given page, and returns it. */ | ||||||
| Int32@, Int32@) | 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, | <p>For example, a document might have five pages of introduction with roman | ||||||
| Int32) | numerals, followed by the rest of the pages in decimal arabic, numbered | ||||||
|  | from one: | ||||||
|  |  | ||||||
| Builds a PDF date string from individual components. | <p>labelstyle = LowercaseRoman<br/> | ||||||
|  | labelprefix = ""<br/> | ||||||
|  | startpage = 1<br/> | ||||||
|  | startvalue = 1<br/> | ||||||
|  |  | ||||||
| Cpdf.getPageRotation(Cpdf.Pdf, Int32) | <p>labelstyle = DecimalArabic<br/> | ||||||
|  | labelprefix = ""<br/> | ||||||
|  | startpage = 6<br/> | ||||||
|  | startvalue = 1<br> */ | ||||||
|  | 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@) | public String getPageLabelPrefix(int n) throws CpdfError; | ||||||
|  |  | ||||||
| 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 |  | ||||||
|   | |||||||
| @@ -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 | /** Attaches data to a page from memory. | ||||||
| should be attached. | @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 <code>0...(n - 1)</code>. 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) | public native void endGetAttachments() throws CpdfError;  | ||||||
|  |  | ||||||
| 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. |  | ||||||
|   | |||||||
| @@ -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 <code>min_required_resolution</code>, returning the total | ||||||
|  | number. So, to return all image uses, specify a very high | ||||||
|  | <code>min_required_resolution</code>. Then, call the other functions giving | ||||||
|  | a serial number <code>0...n - 1</code>, 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 | public native void endGetImageResolution() throws CpdfError; | ||||||
|  |  | ||||||
| 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. |  | ||||||
|   | |||||||
| @@ -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 | ||||||
|  | <code>0...n - 1</code> 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 | /** Removes all font data from a file. */ | ||||||
| numberFonts to return the number of fonts. For each font, call one or more of | public native void removeFonts(Pdf pdf) throws CpdfError; | ||||||
| getFontPage, getFontName, getFontType, and getFontEncoding giving a serial |  | ||||||
| number 0..n - 1 to return information. Finally, call endGetFontInfo to clean |  | ||||||
| up. |  | ||||||
|  |  | ||||||
| Cpdf.removeFonts(Cpdf.Pdf) | /** Copies the given font | ||||||
|  | from the given page in the 'from' PDF to every page in the 'to' PDF. The | ||||||
| Removes all font data from a file. | new font is stored under its font name. | ||||||
|  | @param from_pdf PDF document to copy from | ||||||
| Cpdf.copyFont(Cpdf.Pdf, Cpdf.Pdf, List{Int32}, Int32, String) | @param to_pdf PDF document to copy to | ||||||
|  | @param range page range | ||||||
| Copies the given font from the given page in the 'from' PDF to every page in | @param pagenumber page number of the page to copy from | ||||||
| the 'to' PDF. The new font is stored under its font name. | @param fontname font name */ | ||||||
|  | public native void copyFont(Pdf from_pdf, Pdf to_pdf, Range range, | ||||||
|  |                             int pagenumber, String fontname) | ||||||
|  |     throws CpdfError; | ||||||
|   | |||||||
| @@ -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, | /** Like outputJSON, but it writes to a byte array in memory. | ||||||
| page content is parsed. If no_stream_data is true, all stream data is | @param pdf PDF document | ||||||
| suppressed entirely. | @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. | /** Loads a PDF from a JSON file in memory. */ | ||||||
|  | public native Pdf fromJSONMemory(byte[] data) throws CpdfError; | ||||||
| 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 |  | ||||||
|   | |||||||
| @@ -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 | ||||||
|  | <code>0..n - 1</code> is returned. */ | ||||||
|  | public native int startGetOCGList(Pdf pdf) throws CpdfError; | ||||||
|  |  | ||||||
| Begins retrieving optional content group names. The serial number 0..n - 1 is | /** Retrieves an entry in the optional content group list, given the serial | ||||||
| returned. | number <code>0..n - 1</code>. */ | ||||||
|  | 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. | /** 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 | ||||||
| Cpdf.OCGRename(Cpdf.Pdf, String, String) | optional content groups. This function will merge the two into a single | ||||||
|  | optional content group. */ | ||||||
| Renames an optional content group. | public native void OCGCoalesce(Pdf pdf) throws CpdfError; | ||||||
|  |  | ||||||
| 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. |  | ||||||
|   | |||||||
| @@ -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 | /** Makes a blank document given a page size and number of pages. | ||||||
| points), 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. | /** Typesets a UTF8 text file ragged right on a page of the given size in | ||||||
|  | the given font and font size. | ||||||
| Cpdf.textToPDF(Double, Double, Cpdf.Font, Double, String) | @param papersize paper size, such as {@link #a0portrait a0portrait} | ||||||
|  | @param font font, such as {@link #timesRoman timesRoman} | ||||||
| Typesets a UTF8 text file ragged right on a page of size w * h in points in the | @param fontsize font size | ||||||
| given font and font size. | @param filename file name */ | ||||||
|  | public Pdf textToPDFPaper(int papersize, int font, double fontsize, | ||||||
| Cpdf.textToPDFPaper(Cpdf.Papersize, Cpdf.Font, Double, String) |                           String filename) | ||||||
|  |     throws CpdfError; | ||||||
| Typesets a UTF8 text file ragged right on a page of the given size in the given |  | ||||||
| font and font size. |  | ||||||
|   | |||||||
| @@ -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 | ||||||
|  | <code>boxes</code> is <code>true</code>. | ||||||
|  | @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' | /** Removes all text from the given pages in a given document. */ | ||||||
| is true. | 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 <code>min_thickness</code> to | ||||||
|  | <code>min_thickness</code>. 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 <code>/ID</code> 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 <code>/ID</code>. */ | ||||||
|  | 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 | /** Removes any dictionary entry with the given key whose value matches the | ||||||
| in points. | 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. | /** Returns a JSON array containing any and all values associated with | ||||||
|  | the given key, and fills in its length. | ||||||
| Cpdf.setVersion(Cpdf.Pdf, Int32) | @param pdf PDF document | ||||||
|  | @param key key to search for */ | ||||||
| Sets the minor version number of a document. | public native byte[] getDictEntries(Pdf pdf, String key) throws CpdfError; | ||||||
|  |  | ||||||
| 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. |  | ||||||
|   | |||||||
| @@ -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 | 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 | has access to the cpdf DLL, which is not part of the Java .jar. You can add as | ||||||
| it to a Visual Studio project as a file, set to copy-to-output-folder. Or, you | am external requirement in your Java IDE. Or, you can install it in a standard | ||||||
| can install it in a standard location. The DLL must be named as follows, for | location, such as the Windows system folder. | ||||||
| .NET to be able to find it: |  | ||||||
|  |  | ||||||
| Windows: cpdf.dll | On Windows, The DLL libcpdf.dll must be renamed to cpdf.dll, for Jcpdf to be | ||||||
| MacOS: libcpdf.dylib | able to find it. | ||||||
| Linux: libcpdf.so |  | ||||||
|  |  | ||||||
| The following documentation is automatically extracted from the XML comments | Follow the instructions at the end of Chapter 1 to write your first program. In | ||||||
| present in the assembly. You can use Intellisense to view them within Visual | addition, the Jcpdf package provides documentation with each function, which | ||||||
| Studio - the documentation here is for completeness. | 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 | Jcpdf.jcpdf = new Jcpdf() | ||||||
| the error. |  | ||||||
|  |  | ||||||
| There is no automatic garbage collection of PDFs. Use the Using keyword and/or | You must call startup() to initialise the library prior to calling any other | ||||||
| the Dispose method on objects of type Cpdf.Pdf to explicitly deallocate PDFs. | 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. | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user