Your client is confused.  PDF version has NOTHING to do with where a PDF gets 
viewed.

-----Original Message-----
From: pepgrifell [mailto:[email protected]] 
Sent: Tuesday, June 14, 2011 7:42 AM
To: [email protected]
Subject: [iText-questions] setting pdf version with PdfCopy

Hi,

I receive a list of Files (PDF's genereated with FOP) and I concatenate them
using PdfCopy (code below). Before opening the document, I call
setPdfVersion(PdfWriter.PDF_VERSION_1_3) but when I open the PDF generated
(checking file properties) it says that PDF version is 1.4.

We need to generate the PDF with version 1.3.  Our client has a web content
management software and when attaches the PDF in a page, it opens a new
browser page with the PDF instead of showing the PDF in the "portlet". They
say that if we generate the PDF with version 1.3 this will not happen ...
(they get the PDF via web service).

Anh help ?

Thanks !

the code we use:

PDFReport is a class that has a method generatePdf().  Using FOP, it
converts an XML and a XSL to a byte array.


        public static byte[] concatenate2(PDFReport[] pdfReports)
        throws Exception {

                ByteArrayOutputStream outputStream;
                outputStream = new ByteArrayOutputStream();
                
                boolean first = true;
                Document document = new Document();
                PdfCopy pdfCopier = null;
                try {
                        pdfCopier = new PdfCopy(document, outputStream);
                } catch (DocumentException e) {                 
                        throw new Exception("Error creating pdfCopy");
                }
                document.open();
                
                for (int i = 0; i < pdfReports.length; i++) {           
                        PdfReader pdfReader = null;
                        try {
                                pdfReader = new 
PdfReader(pdfReports[i].generatePdf());
                                pdfReader.consolidateNamedDestinations();
                                // update page offset
                                int numberOfPages = 
pdfReader.getNumberOfPages();
                                // If first source document, create document 
and copier
                                if (first) {
                                        document.setPageSize(pdfReader
                                                        
.getPageSizeWithRotation(FIRST_PAGE));
                                        first = false;
                                }
                                // Add all readed pages to document
                                PdfImportedPage importedPage;
                                for (int j = 1; j <= numberOfPages; j++) {
                                        importedPage = 
pdfCopier.getImportedPage(pdfReader, j);
                                        pdfCopier.addPage(importedPage);
                                }
                                PRAcroForm form = pdfReader.getAcroForm();
                                if (form != null)
                                        pdfCopier.copyAcroForm(pdfReader);
                        } catch (IOException e) {
                                LOGGER.error(e);
                        } catch (DocumentException e) {
                                LOGGER.error(e);
                        } finally {
                                if (pdfReader != null)
                                        pdfReader.close();
                        }
                }
                document.close();
                byte[] result = outputStream.toByteArray();
                try {
                        outputStream.close();
                } catch (IOException e) {
                        e.printStackTrace();
                }
                
                return result;
        }       




--
View this message in context: 
http://itext-general.2136553.n4.nabble.com/setting-pdf-version-with-PdfCopy-tp3596760p3596760.html
Sent from the iText - General mailing list archive at Nabble.com.

------------------------------------------------------------------------------
EditLive Enterprise is the world's most technically advanced content
authoring tool. Experience the power of Track Changes, Inline Image
Editing and ensure content is compliant with Accessibility Checking.
http://p.sf.net/sfu/ephox-dev2dev
_______________________________________________
iText-questions mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/itext-questions

iText(R) is a registered trademark of 1T3XT BVBA.
Many questions posted to this list can (and will) be answered with a reference 
to the iText book: http://www.itextpdf.com/book/
Please check the keywords list before you ask for examples: 
http://itextpdf.com/themes/keywords.php

------------------------------------------------------------------------------
EditLive Enterprise is the world's most technically advanced content
authoring tool. Experience the power of Track Changes, Inline Image
Editing and ensure content is compliant with Accessibility Checking.
http://p.sf.net/sfu/ephox-dev2dev
_______________________________________________
iText-questions mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/itext-questions

iText(R) is a registered trademark of 1T3XT BVBA.
Many questions posted to this list can (and will) be answered with a reference 
to the iText book: http://www.itextpdf.com/book/
Please check the keywords list before you ask for examples: 
http://itextpdf.com/themes/keywords.php

Reply via email to