itext

How to convert an existing A4 PDF document to an A3 booklet?

匆匆过客 提交于 2020-01-07 11:19:29
问题 Hi We have a requirement to convert an existing A4 size pdf to A3 Size PDF in java. Since i am new to itext api conversion pdfs, Can anyone guide me how to do in java using itext or any other api to do. If sample reference provided then appreciable. UPDATe: Output PDF should be in A3 booklet format. 回答1: Please take a look at the MakeA3Booklet example. In this example, we take an existing PDF document with 299 A4 pages (primes.pdf) and we convert it to a 150-page A3 booklet (a3_booklet.pdf):

iText HTML to PDF for non-english content images are very small in PDF

。_饼干妹妹 提交于 2020-01-07 08:00:12
问题 I am using iText 5.4.1 API to convert HTML to PDF, for English HTML the GIF, JPG images are coming good and same size in PDF as with HTML, but when I use Brazil country HTML the GIF, JPG images are very small. Please find the code snippet below. com.itextpdf.text.Document document = new com.itextpdf.text.Document(); PdfWriter writer = PdfWriter.getInstance(document, new FileOutputStream(pdfFileNameWithPath)); document.open(); HtmlPipelineContext htmlContext = new HtmlPipelineContext(null);

Why doesn't the itext barcode fit the page

我的未来我决定 提交于 2020-01-07 06:43:11
问题 I am trying to fit a 417 barcode generated by itext into the pdf page. I just spills out of the page. Also the barcode looks different compared to the barcode in adobe acrobat. I have tried and played around with different settings , nothing has worked so far. The original adobe pdf has y/x ratio of 2, and x = 0.0133 inches and error correction 5. I have tried the same settings in itext. Should I create a box first and do something to fit the image in a box. ? 来源: https://stackoverflow.com

itext7: Check for visible content in a specific area

橙三吉。 提交于 2020-01-07 05:07:18
问题 I want to check specific parts of a pdf file for visible content. With the PdfCanvasProcessor and a custom eventlistener it is possible to check for text and images but for other kind of content this does not work. So what would be the best approach to check fot any visible content? Regards, Marco 来源: https://stackoverflow.com/questions/46104097/itext7-check-for-visible-content-in-a-specific-area

LTV of Certifying Signatures

流过昼夜 提交于 2020-01-06 21:58:36
问题 I've been working with iText to do digital signatures on PDF files for the past weeks and based on what i've understood that there is two ways to add the information to the PDF to make it LTV enabled: Adding the information with the code provided in the iText example, this method requires the signature to be already present because the DSS & VRI dictionaries it creates references the signature. Embedding the crl bytes & ocsp response in the signature at signing time. Eventhough the first

Read PDF file and offer it as download with iText

久未见 提交于 2020-01-06 19:56:46
问题 How can I read a local PDF file and offer it as a download in the browser with iText? This is what I tried, but the file always says: Adobe Reader could not open "xxx.pdf" because it is either not a supported file type or because the file has been damaged (for example, it was sent as an email attachement and wasn't correclty decoded). PdfReader reader = new PdfReader(filename); byte[] streamBytes = reader.getPageContent(1); response.setContentType("application/force-download"); response

iText PDF Rectangle fill with color

拟墨画扇 提交于 2020-01-06 19:56:16
问题 I want to fill rectangle with color. I used these code but not working. PdfContentByte canvas = writer.getDirectContent(); canvas.rectangle(50, 600, 500, 40); canvas.setColorFill(BaseColor.GRAY); //canvas.setRGBColorFill(20, 50, 30); //canvas.setCMYKColorFill(0, 0, 0, 75); canvas.setColorStroke(BaseColor.LIGHT_GRAY); canvas.stroke(); Anyone has idea how to fill it ? 回答1: You have to call canvas.fill() after setColorFill() PdfContentByte canvas = writer.getDirectContent(); canvas.rectangle(50,

iText PDF Rectangle fill with color

我怕爱的太早我们不能终老 提交于 2020-01-06 19:55:07
问题 I want to fill rectangle with color. I used these code but not working. PdfContentByte canvas = writer.getDirectContent(); canvas.rectangle(50, 600, 500, 40); canvas.setColorFill(BaseColor.GRAY); //canvas.setRGBColorFill(20, 50, 30); //canvas.setCMYKColorFill(0, 0, 0, 75); canvas.setColorStroke(BaseColor.LIGHT_GRAY); canvas.stroke(); Anyone has idea how to fill it ? 回答1: You have to call canvas.fill() after setColorFill() PdfContentByte canvas = writer.getDirectContent(); canvas.rectangle(50,

IText font not subsetting or embedding

本秂侑毒 提交于 2020-01-06 19:37:30
问题 I am on the mainframe platform and uploaded the arial.ttf from Windows. I used the following code for the font, but the font does not show SUBSETTED or EMBEDDED in Adobe. I even tried to add font.getBaseFont to force it to embed. Any reason why it would not embed or subset? String font1 = "arial.ttf"; FontFactory.register(font1,"myfont"); BaseFont bf = BaseFont.createFont(font1, BaseFont.IDENTITY_H, true); Font font = FontFactory.getFont("arial"); font.getBaseFont().setSubset(true); Adobe doc

iTextSharp - Creating header/margins results in inconsistent page coordinates

空扰寡人 提交于 2020-01-06 17:58:57
问题 Why does the following code affect a page's ability to find its top, bottom, right and left? Before applying it, reader.GetCropBox(i).GetLeft(0) and reader.GetPageSize(i).GetLeft(0) return the far left point of every page in an assorted set. After applying it, GetLeft(0) is the far left on some pages and on others the left most point AFTER the margin ends. I'm trying to create a header on any given set of preexisting pages (ie, create white space and then put text in it) using (Stream stream