[ 
https://issues.apache.org/jira/browse/PDFBOX-3198?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16777678#comment-16777678
 ] 

Aleksandr Beliakov commented on PDFBOX-3198:
--------------------------------------------

Good afternoon,

When I validate the example of signed document from attachments 
"PDFBOX-3917_signed.pdf" with a PreflightParser/PreflightDocument classes, I 
have a list of errors:
{noformat}
Trailer Syntax error, /XRef cross reference streams are not allowed
Invalid Color space, DestOutputProfile is missing
Invalid Font definition, Helvetica-Bold: some required fields are missing from 
the Font dictionary: firstChar, lastChar, widths.
Invalid Font definition, Helvetica-Bold: FontFile entry is missing from 
FontDescriptor
Invalid Color space, /DeviceGray default for operator "Tj" can't be used 
without Color Profile
Invalid Color space, /DeviceGray default for operator "Tj" can't be used 
without Color Profile
Invalid Color space, /DeviceGray default for operator "Tj" can't be used 
without Color Profile
Invalid Color space, DestOutputProfile is missing
Invalid Color space, /DeviceGray default for operator "Tj" can't be used 
without Color Profile
Invalid Color space, /DeviceGray default for operator "Tj" can't be used 
without Color Profile
Invalid Color space, /DeviceGray default for operator "Tj" can't be used 
without Color Profile
Invalid Color space, DestOutputProfile is missing
Invalid Color space, /DeviceGray default for operator "Tj" can't be used 
without Color Profile
Invalid Color space, /DeviceGray default for operator "Tj" can't be used 
without Color Profile
Invalid Color space, /DeviceGray default for operator "Tj" can't be used 
without Color Profile
Invalid Color space, ICCBased color space is invalid: Invalid ICC Profile Data
Invalid Color space, ICCBased color space is invalid: Invalid ICC Profile Data
Invalid Color space, ICCBased color space is invalid: Invalid ICC Profile Data
Invalid Color space, ICCBased color space is invalid: Invalid ICC Profile Data
Invalid Color space, ICCBased color space is invalid: Invalid ICC Profile Data
Invalid Color space, ICCBased color space is invalid: Invalid ICC Profile Data
Invalid Color space, ICCBased color space is invalid: Invalid ICC Profile Data
Invalid Color space, ICCBased color space is invalid: Invalid ICC Profile Data
Invalid Color space, ICCBased color space is invalid: Invalid ICC Profile Data
Invalid Color space, ICCBased color space is invalid: Invalid ICC Profile Data
Error on MetaData, PDF/A identification schema http://www.aiim.org/pdfa/ns/id/ 
is missing{noformat}
My code to validate the document is following:
{code:java}
PreflightParser parser = new PreflightParser(new ByteArrayDataSource(is));
parser.parse();
PreflightDocument preflightDocument = parser.getPreflightDocument();
preflightDocument.validate();
ValidationResult result = preflightDocument.getResult();
List<ValidationError> errorsList = result.getErrorsList();
{code}
When I create my own document based on your code from example 
"CreateVisibleSignature2.java" I have some of the errors related to a Font 
element:
{noformat}
Invalid Font definition, Times-Roman: some required fields are missing from the 
Font dictionary: firstChar, lastChar, widths.
Invalid Font definition, Times-Roman: FontFile entry is missing from 
FontDescriptor{noformat}
My question is does the code from example produce a correct pdf structure? What 
can I do to avoid these errors? My current code looks like this:
{code:java}
try (PDPageContentStream cs = new PDPageContentStream(doc, appearanceStream);)
{
    cs.beginText();
    cs.setFont(PDType1Font.TIMES_ROMAN, 12);
    cs.setNonStrokingColor(Color.BLACK);
    cs.newLineAtOffset(20);
    cs.showText("My string");
    cs.endText();
}{code}
Best regards,

Aleksandr.

> Visible Signature N2 layer / Support signature with text
> --------------------------------------------------------
>
>                 Key: PDFBOX-3198
>                 URL: https://issues.apache.org/jira/browse/PDFBOX-3198
>             Project: PDFBox
>          Issue Type: New Feature
>          Components: Signing
>    Affects Versions: 1.8.11
>            Reporter: Frank Cornelis
>            Assignee: Tilman Hausherr
>            Priority: Minor
>             Fix For: 2.0.9, 3.0.0 PDFBox
>
>         Attachments: CreateVisibleSignature2.java, 
> CreateVisibleSignature2.java, CreateVisibleSignature2.java, 
> PDFBOX-3198-visible-signature.zip, PDFBOX-3198-work-5.5.2017.zip, 
> PDFBOX-3917_signed.pdf, helloworld_signed.pdf, pdfbox-n2-2.patch, signed.pdf
>
>
> The patch adds N2 layer support to visible signatures.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to