Creating PDF/XHTML Files with Adobe Acrobat DC
Introduction
Adobe Acrobat DC is a powerful tool that allows users to create, edit, and share PDF documents. One of its lesser-known features is the ability to create PDF/XHTML files, which are essentially PDF files that contain XHTML code within them. This feature can be particularly useful for developers who need to create PDF documents that contain programmatically generated content, or for designers who want to create PDF documents that can be easily edited using HTML and CSS.
In this article, we will cover the key concepts and steps involved in creating PDF/XHTML files with Adobe Acrobat DC. We will provide detailed context and guidance on how to use the software's features to generate high-quality PDF/XHTML files that can be easily edited and modified using standard web development tools.
Key Concepts
Before we dive into the specific steps involved in creating PDF/XHTML files with Adobe Acrobat DC, it's important to understand some of the key concepts and terminology associated with this feature.
PDF/XHTML
PDF/XHTML is a type of PDF file that contains XHTML code within it. This code can be styled and formatted using CSS, and can be easily edited and modified using standard web development tools.
XHTML
XHTML is a markup language that is similar to HTML, but is stricter and more structured. XHTML documents must be well-formed, meaning that they must include a valid root element, and all tags must be properly closed and nested.
Acrobat DC
Adobe Acrobat DC is a powerful PDF editor and creator that includes a range of features for working with PDF documents. Among these features is the ability to create PDF/XHTML files.
Creating PDF/XHTML Files
To create a PDF/XHTML file with Adobe Acrobat DC, follow these steps:
Step 1: Create a new PDF document
To create a new PDF/XHTML file, start by creating a new PDF document using Acrobat DC. You can do this by clicking on the "Create" button on the Acrobat DC toolbar, and then selecting "PDF from File." From here, you can select the files that you want to include in your PDF document.
Step 2: Enable XHTML import
Once you have created a new PDF document, you need to enable XHTML import. To do this, click on the "Tools" menu in Acrobat DC, and then select "Prepare Form." From here, click on the "Edit" button, and then select "Add or Edit Fields." In the Field Properties dialog box, click on the "Format" tab, and then select "Rich Text" from the Format Type drop-down menu.
Step 3: Paste XHTML code
With XHTML import enabled, you can now paste your XHTML code into Acrobat DC. To do this, simply copy the XHTML code from your preferred text editor, and then paste it into the Rich Text field in Acrobat DC.
Step 4: Style and format the XHTML code
Once you have pasted your XHTML code into Acrobat DC, you can style and format it using CSS. To do this, click on the "Tools" menu in Acrobat DC, and then select "Prepare Form." From here, click on the "Actions" tab, and then select "Run a JavaScript." In the JavaScript Editor dialog box, you can add custom CSS styles and formatting to your XHTML code.
Step 5: Save the PDF/XHTML file
Once you have finished styling and formatting your XHTML code, you can save the PDF/XHTML file. To do this, click on the "File" menu in Acrobat DC, and then select "Save As." From here, select " PDF (*.pdf)" as the file format, and then specify the location where you want to save the file.
Conclusion
In this article, we have covered the key concepts and steps involved in creating PDF/XHTML files with Adobe Acrobat DC. By following the steps outlined above, you can create high-quality PDF documents that contain programmatically generated XHTML code, which can be easily edited and modified using standard web development tools.
Summary
In this article, we have covered the following topics:
- Introduction to PDF/XHTML
- Key concepts and terminology associated with PDF/XHTML
- Steps involved in creating PDF/XHTML files with Adobe Acrobat DC
- Creating a new PDF document
- Enabling XHTML import
- Pasting XHTML code
- Styling and formatting XHTML code
- Saving the PDF/XHTML file
- Creating a new PDF document
References
- Adobe Acrobat DC Help: Create a PDF from an HTML file
- Adobe Acrobat DC JavaScript API: Form Field Objects
- XHTML 1.0 Specification
- CSS: Cascading Styles Sheets Level 2 Revision 1 (CSS 2.1) Specification
// Example JavaScript code for styling XHTML code in Acrobat DC:
// Add custom CSS styles
app.alert("Add custom CSS styles", 3);
this.getField("myXHTMLField").setFieldProperty("textFormat", "html");
this.getField("myXHTMLField").setRichTextValue("Hello, world!");
// Example XHTML code for a simple PDF/XHTML file:
My PDF/XHTML document
Introduction
This is a simple PDF/XHTML document that contains XHTML code.
Key Concepts
Here are some key concepts associated with PDF/XHTML:
- XHTML is a markup language that is similar to HTML
- XHTML documents must be well-formed, meaning that they must include a valid root element
- PDF/XHTML files can be styled and formatted using CSS