private boolean mergeFontsEnabled;
+ private boolean mergeFormFieldsEnabled;
+
private boolean linearizationEnabled;
private boolean formXObjectEnabled;
* @param obj {@link PDFObject} to add
* @return the added {@link PDFObject} added (with its object number set)
*/
- <T extends PDFObject> T registerTrailerObject(T obj) {
+ public <T extends PDFObject> T registerTrailerObject(T obj) {
assignObjectNumber(obj);
addTrailerObject(obj);
return obj;
}
}
+ public boolean isMergeFormFieldsEnabled() {
+ return mergeFormFieldsEnabled;
+ }
+
+ public void setMergeFormFieldsEnabled(boolean mergeFormFieldsEnabled) {
+ this.mergeFormFieldsEnabled = mergeFormFieldsEnabled;
+ }
+
private interface TrailerOutputHelper {
void outputStructureTreeElements(OutputStream stream) throws IOException;
private final PDFDocumentNavigationHandler documentNavigationHandler
= new PDFDocumentNavigationHandler(this);
+ private Map<String, Object> usedFieldNames = new HashMap<>();
private Map<Integer, PDFArray> pageNumbers = new HashMap<Integer, PDFArray>();
private Map<String, PDFReference> contents = new HashMap<String, PDFReference>();
return structureTreeBuilder;
}
+ public Map<String, Object> getUsedFieldNames() {
+ return usedFieldNames;
+ }
+
public Map<Integer, PDFArray> getPageNumbers() {
return pageNumbers;
}
PDFRenderingContext pdfContext = new PDFRenderingContext(
getUserAgent(), generator, getDocumentHandler().getCurrentPage(), getFontInfo());
pdfContext.setMarkedContentInfo(imageMCI);
+ pdfContext.setUsedFieldNames(getDocumentHandler().getUsedFieldNames());
pdfContext.setPageNumbers(getDocumentHandler().getPageNumbers());
pdfContext.setPdfLogicalStructureHandler(logicalStructureHandler);
pdfContext.setCurrentSessionStructElem((PDFStructElem) getContext().getStructureTreeElement());
import static org.apache.fop.render.pdf.PDFRendererOption.FORM_XOBJECT;
import static org.apache.fop.render.pdf.PDFRendererOption.LINEARIZATION;
import static org.apache.fop.render.pdf.PDFRendererOption.MERGE_FONTS;
+import static org.apache.fop.render.pdf.PDFRendererOption.MERGE_FORM_FIELDS;
import static org.apache.fop.render.pdf.PDFRendererOption.OUTPUT_PROFILE;
import static org.apache.fop.render.pdf.PDFRendererOption.PDF_A_MODE;
import static org.apache.fop.render.pdf.PDFRendererOption.PDF_UA_MODE;
parseAndPut(OUTPUT_PROFILE, cfg);
parseAndPut(DISABLE_SRGB_COLORSPACE, cfg);
parseAndPut(MERGE_FONTS, cfg);
+ parseAndPut(MERGE_FORM_FIELDS, cfg);
parseAndPut(LINEARIZATION, cfg);
parseAndPut(FORM_XOBJECT, cfg);
parseAndPut(VERSION, cfg);
return Boolean.valueOf(value);
}
},
+ MERGE_FORM_FIELDS("merge-form-fields", false) {
+ @Override
+ Boolean deserialize(String value) {
+ return Boolean.valueOf(value);
+ }
+ },
LINEARIZATION("linearization", false) {
@Override
Boolean deserialize(String value) {
import static org.apache.fop.render.pdf.PDFRendererOption.FORM_XOBJECT;
import static org.apache.fop.render.pdf.PDFRendererOption.LINEARIZATION;
import static org.apache.fop.render.pdf.PDFRendererOption.MERGE_FONTS;
+import static org.apache.fop.render.pdf.PDFRendererOption.MERGE_FORM_FIELDS;
import static org.apache.fop.render.pdf.PDFRendererOption.OUTPUT_PROFILE;
import static org.apache.fop.render.pdf.PDFRendererOption.PDF_A_MODE;
import static org.apache.fop.render.pdf.PDFRendererOption.PDF_UA_MODE;
return (Boolean)properties.get(MERGE_FONTS);
}
+ public Boolean getMergeFormFieldsEnabled() {
+ return (Boolean)properties.get(MERGE_FORM_FIELDS);
+ }
+
public Boolean getLinearizationEnabled() {
return (Boolean)properties.get(LINEARIZATION);
}
private FontInfo fontInfo;
private PDFPage page;
private MarkedContentInfo mci;
+ private Map<String, Object> usedFieldNames;
private Map<Integer, PDFArray> pageNumbers;
private PDFLogicalStructureHandler pdfLogicalStructureHandler;
private PDFStructElem currentSessionStructElem;
return mci;
}
+ public Map<String, Object> getUsedFieldNames() {
+ return usedFieldNames;
+ }
+
+ public void setUsedFieldNames(Map<String, Object> usedFieldNames) {
+ this.usedFieldNames = usedFieldNames;
+ }
+
public Map<Integer, PDFArray> getPageNumbers() {
return pageNumbers;
}
this.pdfDoc.enableAccessibility(userAgent.isAccessibilityEnabled());
pdfDoc.setMergeFontsEnabled(rendererConfig.getMergeFontsEnabled());
+ pdfDoc.setMergeFormFieldsEnabled(rendererConfig.getMergeFormFieldsEnabled());
pdfDoc.setLinearizationEnabled(rendererConfig.getLinearizationEnabled());
pdfDoc.setFormXObjectEnabled(rendererConfig.getFormXObjectEnabled());
import static org.apache.fop.render.pdf.PDFRendererOption.DISABLE_SRGB_COLORSPACE;
import static org.apache.fop.render.pdf.PDFRendererOption.FILTER_LIST;
import static org.apache.fop.render.pdf.PDFRendererOption.FORM_XOBJECT;
+import static org.apache.fop.render.pdf.PDFRendererOption.MERGE_FORM_FIELDS;
import static org.apache.fop.render.pdf.PDFRendererOption.OUTPUT_PROFILE;
import static org.apache.fop.render.pdf.PDFRendererOption.PDF_A_MODE;
import static org.apache.fop.render.pdf.PDFRendererOption.PDF_X_MODE;
return this;
}
+ public PDFRendererConfBuilder setMergeFormFieldsEnabled(boolean b) {
+ createTextElement(MERGE_FORM_FIELDS, String.valueOf(b));
+ return this;
+ }
+
public final class EncryptionParamsBuilder {
private final Element el;
public void testErroneousPDFVersionsNotSet() throws Exception {
pdfVersionTester("");
}
+
+ @Test
+ public void testMergeFormFields() throws Exception {
+ parseConfig(createRenderer().setMergeFormFieldsEnabled(true));
+ assertTrue(conf.getConfigOptions().getMergeFormFieldsEnabled());
+ }
}