« Return to Thread: Loading PDF files for concatenating from jar

Re: Loading PDF files for concatenating from jar

by Peter Rait :: Rate this Message:

Reply to Author | View in Thread

1T3XT 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

 « Return to Thread: Loading PDF files for concatenating from jar

LightInTheBox - Buy quality products at wholesale price