|
View:
New views
3 Messages
—
Rating Filter:
Alert me
|
|
|
Loading PDF files for concatenating from jarHi,
I am distributing my application in a jar file. In this application I have to merge a dynamically created PDF with some already existing PDF files which are actually in the same directory as the jar file. I have also a csv file used for PDF creation in this directory. I would like to move these files into the JAR containing my application. How can I then access these files within my application? Is there an example? I found this code in a JAVA forum topic with the title 'open a file which is in the jar file': // to get an InputStream from root of a jar file ClassLoader cl = this.getClass().getClassLoader(); InputStream in = cl.getResourceAsStream("myFile.txt"); Can this be a possible solution when opening a PDFReader for concatenating the PDF files? How do I navigate within the jar? Regards Peter ------------------------------------------------------------------------- This SF.net email is sponsored by: Microsoft Defy all challenges. Microsoft(R) Visual Studio 2008. http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/ _______________________________________________ iText-questions mailing list iText-questions@... https://lists.sourceforge.net/lists/listinfo/itext-questions Do you like iText? Buy the iText book: http://www.1t3xt.com/docs/book.php Or leave a tip: https://tipit.to/itexttipjar |
|
|
Re: Loading PDF files for concatenating from jarPeter Rait wrote:
> Hi, > > I am distributing my application in a jar file. In this application I have to merge a dynamically created PDF with some already existing PDF files which are actually in the same directory as the jar file. I have also a csv file used for PDF creation in this directory. > I would like to move these files into the JAR containing my application. How can I then access these files within my application? Is there an example? > I found this code in a JAVA forum topic with the title 'open a file which is in the jar file' This is an off-topic issue on the iText mailing list, but incidentally iText reads files from jars too: for instance the afm files in the font dictionary. See BaseFont.getResourceStream(String key, ClassLoader loader) for inspiration. -- This answer is provided by 1T3XT BVBA ------------------------------------------------------------------------- This SF.net email is sponsored by: Microsoft Defy all challenges. Microsoft(R) Visual Studio 2008. http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/ _______________________________________________ iText-questions mailing list iText-questions@... https://lists.sourceforge.net/lists/listinfo/itext-questions Do you like iText? Buy the iText book: http://www.1t3xt.com/docs/book.php Or leave a tip: https://tipit.to/itexttipjar |
|
|
Re: Loading PDF files for concatenating from jar1T3XT info schrieb:
> > This is an off-topic issue on the iText mailing list, > but incidentally iText reads files from jars too: > for instance the afm files in the font dictionary. > > See BaseFont.getResourceStream(String key, ClassLoader loader) > for inspiration. Thanks for the hint. Even if it seems to be off-topic here is the solution I found: String InputFile="MyInput.pdf"; ClassLoader cl= myinstance.getClass().getClassLoader(); InputStream in = cl.getResourceAsStream(InputFile); PdfReader reader = new PdfReader(in); In this case the PDF for input was in the root directory of the JAR. Best regards Peter ------------------------------------------------------------------------- This SF.net email is sponsored by: Microsoft Defy all challenges. Microsoft(R) Visual Studio 2008. http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/ _______________________________________________ iText-questions mailing list iText-questions@... https://lists.sourceforge.net/lists/listinfo/itext-questions Do you like iText? Buy the iText book: http://www.1t3xt.com/docs/book.php Or leave a tip: https://tipit.to/itexttipjar |
| Free Forum Powered by Nabble | Forum Help |