-
Notifications
You must be signed in to change notification settings - Fork 397
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
PDF/UA support, part 2 #2018
base: master
Are you sure you want to change the base?
PDF/UA support, part 2 #2018
Conversation
…rfluous NonStruct tags for table caption
…hich is only allocated when a container is actually split.
…pends on context, eg TD or TDF
… remove Flash support
…nts for string literals
- Added some example PDF/UA reports. - Add support for declaring newer PDF/A versions. - Add support for declaring PDF/UA-2. - Add support for declaring PDF 2.0. - Use "auto" as default value for tagType property for some report element types to allow automatic context-depending setting as well as explicit setting. - Support generating "Caption" tag for tables. - Fix page-break handling of table rows and cells. - Create corresponding PDF tags for some HTML elements. - Add hyperlink support. - Allow creation of a PDF that conforms to PDF/A and PDF/UA at the same time. - Fixed specifying the document language based on report locale setting. - Added THead, TBody, TFoot tags for tables. - Fixed PDF syntax errors (contentByte.setColorStroke was called at wrong place in drawing sequence). - Removed support for Acrobat Flash. - Refactored attributes needed for split tracking into a dedicated class. - Refactoring of some PDF-tag related constants. - Added or improved some comments. - Removed some warnings. I originally developed this using my hobby account hvbargen over several weeks.
Reminder: Page numbering with the auto-text item causes and exception. I already added a commit and an example report with this commit,which I should add here when I'm at work again. |
Was the issue existing before or is it a reason of the changes? |
The issue was existing before when you tried to generate PDF/UA. |
Sorry, I was just merging the aforementioned commit into this branch. This has unfortunately caused all the single little commits to be added here. In fact the latest addition only added a few lines to PDFPage.java and InlineContainer.java, and an example report. |
Does not matter, we will squash anyway. Can you please also make unit tests? |
I don't think that unit tests are useful in any way for this kind of change. |
I'm glad that you agree.
We only need to add them to a unit test project. I have looked at veraPDF here: https://docs.verapdf.org/install/ and it is only a 10MB download and supports headless installation. WDYT? Can we squeeze some more time out of you? 💞 |
I'll see what I can do this weekend. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The most changes are added to get comments and some coding styles.
Also the question is added if it make sense to add PDF 2.0 support when we throw an exception if it is used through the report developer.
PdfArray kids; | ||
PdfObject kido = currentPageDevice.structureCurrentLeaf.get(PdfName.K); | ||
if (kido == null) { | ||
kids = new PdfArray(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The standard convention is to use name like "child" & "children" instead of "kid" and "kids".
Therefore change it to child & children.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The naming is used this way inside OpenPDF and the rare examples I could find in the net. Thus I used the same naming convention.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
But the BIRT developer used Schild & children, you are the first with Kids.
There is no Methode with "getKids" but you will finde "getChildren" and "getFirstChild()".
So it would be good to keep on child & children.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Even for English it's poor English and I don't recall seeing such terminology used elsewhere.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, lets use the children and child convention. I understand your idea to follow their pattern, but we should stick to our own.
break; | ||
} | ||
} catch (Exception e) { | ||
logger.log(Level.WARNING, e.getMessage(), e); | ||
} | ||
if (currentPageDevice.isTagged()) { | ||
PdfArray kids; | ||
PdfObject kido = currentPageDevice.structureCurrentLeaf.get(PdfName.K); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Better name for "kido" = "kid-object", normally we name it child e.r. "childPdfObj" or "childPdf"
import com.lowagie.text.pdf.PdfName; | ||
|
||
/** | ||
* @since 4.19 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A description of the class is missing. You are the developer with the deepest knowledge and for other developers it would be helpfull to have a short description.
package org.eclipse.birt.report.engine.emitter.pdf; | ||
|
||
/** | ||
* @since 4.19 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A description of the class is missing. You are the developer with the deepest knowledge and for other developers it would be helpfull to have a short description.
* @since 4.19 | ||
* | ||
*/ | ||
@SuppressWarnings("javadoc") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The core pain of the old code is that there is no documentation is given on class, methode and property level.
So it would be much better to avoid the "SuppressWarnings" and add regularly comments to all elements.
super(); | ||
} | ||
/** | ||
* |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Description is missing.
private static class PDFAExtensionSchema extends XmpSchema { | ||
|
||
/** | ||
* |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Description is missing.
*/ | ||
private static final long serialVersionUID = 6654512771721220538L; | ||
|
||
public PDFAExtensionSchema() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Comment would be helpful which header details for which version woll be created.
case PdfWriter.PDFA1B: | ||
a1.addPart("1"); | ||
break; | ||
case PDFA2A: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add the class of the constant or remove it from the constants before.
} | ||
switch (PdfXConformance) { | ||
case PdfWriter.PDFA1A: | ||
case PDFA2A: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add the class of the constant or remove it from the constants before.
Great work, I would like to encourage you to complete this and merge it. Well done. |
I originally developed this using my hobby account hvbargen over several weeks.