PdfXConformanceException

View: New views
7 Messages — Rating Filter:   Alert me  

PdfXConformanceException

by GaneshPrakhya :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi Bruno,

I am trying to create a PDF document with PDFX conformance. When I run the programme, I am getting the following exception.

Exception in thread "main" com.lowagie.text.pdf.PdfXConformanceException: All th
e fonts must be embedded.
        at com.lowagie.text.pdf.PdfWriter.checkPDFXConformance(Unknown Source)
        at com.lowagie.text.pdf.PdfWriter.addSimple(Unknown Source)
        at com.lowagie.text.pdf.PdfContentByte.setFontAndSize(Unknown Source)
        at com.lowagie.text.pdf.PdfDocument.writeLineToContent(Unknown Source)
        at com.lowagie.text.pdf.PdfDocument.flushLines(Unknown Source)
        at com.lowagie.text.pdf.PdfDocument.newPage(Unknown Source)
        at com.lowagie.text.pdf.PdfDocument.close(Unknown Source)
        at com.lowagie.text.Document.close(Unknown Source)
        at NewPage.main(NewPage.java:29)

And, here is my code..

public static void main(String[] args) {

        Document document = new Document();

        try {


            PdfWriter writer = PdfWriter.getInstance(document, new FileOutputStream("D:\\NewPagePDFX.pdf"));

                        writer.setPDFXConformance(PdfWriter.PDFX32002);
                        System.out.println("conformance level:" + writer.getPDFXConformance());

            BaseFont helvetica = BaseFont.createFont(BaseFont.HELVETICA, BaseFont.CP1252, BaseFont.EMBEDDED);
                        Font font = new Font(helvetica, 12, Font.NORMAL);

            document.open();
            document.add(new Paragraph("This is a PDFX document", font));
                        document.close();

        }
        catch(DocumentException de) {
            System.err.println(de.getMessage());
        }
        catch(IOException ioe) {
            System.err.println(ioe.getMessage());
        }


    }

Eventhough I say "BaseFont.EMBEDDED", it is still showing that fonts are not embedded. Can you point out the possible problem in this.

Re: PdfXConformanceException

by Bruno Lowagie (iText) :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

GaneshPrakhya wrote:

>Hi Bruno,
>
>I am trying to create a PDF document with PDFX conformance. When I run the programme, I am getting the following exception.
>
>All the fonts must be embedded.
>
That's one of the requirements of PDF/X.
If you don't embed the font, iText will throw an Exception.

>BaseFont.createFont(BaseFont.HELVETICA,
>BaseFont.CP1252, BaseFont.EMBEDDED);
>  
>
Helvetica is one of the 14 standard Type1 fonts (AKA the base14 fonts,
formerly known as the 'built-in fonts').

>Eventhough I say "BaseFont.EMBEDDED", it is still showing that fonts are not embedded.
>
That's documented in the tutorial: the base14 fonts are never embedded
regardless of the embedded parameter; the same goes for CJK fonts.
Some other fonts are always embedded, even if you set the embedded
parameter to false.

To solve this problem, you should use another font
(for instance arial.ttf, it looks very much the same as Helvetica).

br,
Bruno

-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
iText-questions mailing list
iText-questions@...
https://lists.sourceforge.net/lists/listinfo/itext-questions

Re: PdfXConformanceException

by porcupine :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

you should be doing it this way (Java):

writer.setPDFXConformance(PdfWriter.PDFX32002);
FontFactory.registerDirectories();
Font font = FontFactory.getFont("Helvetica", BaseFont.CP1252, BaseFont.EMBEDDED, 12);
System.out.println("conformance level:" + writer.getPDFXConformance());

assuming you have a Font Face called Helvetica on your system.

GaneshPrakhya wrote:
Hi Bruno,

I am trying to create a PDF document with PDFX conformance. When I run the programme, I am getting the following exception.

Exception in thread "main" com.lowagie.text.pdf.PdfXConformanceException: All th
e fonts must be embedded.
        at com.lowagie.text.pdf.PdfWriter.checkPDFXConformance(Unknown Source)
        at com.lowagie.text.pdf.PdfWriter.addSimple(Unknown Source)
        at com.lowagie.text.pdf.PdfContentByte.setFontAndSize(Unknown Source)
        at com.lowagie.text.pdf.PdfDocument.writeLineToContent(Unknown Source)
        at com.lowagie.text.pdf.PdfDocument.flushLines(Unknown Source)
        at com.lowagie.text.pdf.PdfDocument.newPage(Unknown Source)
        at com.lowagie.text.pdf.PdfDocument.close(Unknown Source)
        at com.lowagie.text.Document.close(Unknown Source)
        at NewPage.main(NewPage.java:29)

And, here is my code..

public static void main(String[] args) {

        Document document = new Document();

        try {


            PdfWriter writer = PdfWriter.getInstance(document, new FileOutputStream("D:\\NewPagePDFX.pdf"));

                        writer.setPDFXConformance(PdfWriter.PDFX32002);
                        System.out.println("conformance level:" + writer.getPDFXConformance());

            BaseFont helvetica = BaseFont.createFont(BaseFont.HELVETICA, BaseFont.CP1252, BaseFont.EMBEDDED);
                        Font font = new Font(helvetica, 12, Font.NORMAL);

            document.open();
            document.add(new Paragraph("This is a PDFX document", font));
                        document.close();

        }
        catch(DocumentException de) {
            System.err.println(de.getMessage());
        }
        catch(IOException ioe) {
            System.err.println(ioe.getMessage());
        }


    }

Eventhough I say "BaseFont.EMBEDDED", it is still showing that fonts are not embedded. Can you point out the possible problem in this.

Re: PdfXConformanceException

by GaneshPrakhya :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Ok, so, in order to create PDFX conformant documents, do I need to use a template which is compliant to PDFX standard? Or is it possible to create PDFX standard documents eventhough I use a template without PDFX compliance?

Thanks,
Ganesh.


Bruno Lowagie wrote:
GaneshPrakhya wrote:

>Hi Bruno,
>
>I am trying to create a PDF document with PDFX conformance. When I run the programme, I am getting the following exception.
>
>All the fonts must be embedded.
>
That's one of the requirements of PDF/X.
If you don't embed the font, iText will throw an Exception.

>BaseFont.createFont(BaseFont.HELVETICA,
>BaseFont.CP1252, BaseFont.EMBEDDED);
>  
>
Helvetica is one of the 14 standard Type1 fonts (AKA the base14 fonts,
formerly known as the 'built-in fonts').

>Eventhough I say "BaseFont.EMBEDDED", it is still showing that fonts are not embedded.
>
That's documented in the tutorial: the base14 fonts are never embedded
regardless of the embedded parameter; the same goes for CJK fonts.
Some other fonts are always embedded, even if you set the embedded
parameter to false.

To solve this problem, you should use another font
(for instance arial.ttf, it looks very much the same as Helvetica).

br,
Bruno

-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
iText-questions mailing list
iText-questions@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/itext-questions

Re: PdfXConformanceException

by Bruno Lowagie (iText) :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

GaneshPrakhya wrote:

>Ok, so, in order to create PDFX conformant documents, do I need to use a template which is compliant to PDFX standard?
>
Yes, I don't know any free tool that knows how to
change an unembedded font into an embedded font.

>Or is it possible to create
>PDFX standard documents eventhough I use a template without PDFX compliance?
>
No, you need a template that is PDF/X compliant.
br,
Bruno

-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
iText-questions mailing list
iText-questions@...
https://lists.sourceforge.net/lists/listinfo/itext-questions

Re: PdfXConformanceException

by Leonard Rosenthol :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

At 08:18 AM 8/25/2006, bruno wrote:
> >Ok, so, in order to create PDFX conformant documents, do I need to
> use a template which is compliant to PDFX standard?
> >
>Yes, I don't know any free tool that knows how to
>change an unembedded font into an embedded font.

         I don't know of any free tools either.  there are a few
commercial solutions that can do it, however...


Leonard

---------------------------------------------------------------------------
Leonard Rosenthol                            <mailto:leonardr@...>
Chief Technical Officer                      <http://www.pdfsages.com>
PDF Sages, Inc.                              215-938-7080 (voice)
                                              215-938-0880 (fax)


-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
iText-questions mailing list
iText-questions@...
https://lists.sourceforge.net/lists/listinfo/itext-questions

Re: ICC Profile

by GaneshPrakhya :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi Paulo,

There is NO ICC profile attached to the image I am using. I am assuming
this by the following code.

Image img = Image.getInstance(imageFile);
System.out.println(img.hasICCProfile());

This returning false. Is there any other way to check whether an ICC
profile presnet or not?

-- Ganesh.

-----Original Message-----
From: itext-questions-bounces@...
[mailto:itext-questions-bounces@...] On Behalf Of
bruno
Sent: Friday, August 25, 2006 5:48 PM
To: Post all your questions about iText here
Subject: Re: [iText-questions] PdfXConformanceException

GaneshPrakhya wrote:

>Ok, so, in order to create PDFX conformant documents, do I need to use
a template which is compliant to PDFX standard?
>
Yes, I don't know any free tool that knows how to change an unembedded
font into an embedded font.

>Or is it possible to create
>PDFX standard documents eventhough I use a template without PDFX
compliance?
>
No, you need a template that is PDF/X compliant.
br,
Bruno

------------------------------------------------------------------------
-
Using Tomcat but need to do more? Need to support web services,
security?
Get stuff done quickly with pre-integrated technology to make your job
easier Download IBM WebSphere Application Server v.1.0.1 based on Apache
Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
iText-questions mailing list
iText-questions@...
https://lists.sourceforge.net/lists/listinfo/itext-questions

-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
iText-questions mailing list
iText-questions@...
https://lists.sourceforge.net/lists/listinfo/itext-questions