GroupDocs.Assembly for Java

Embed content into PDF files effortlessly

Use GroupDocs.Assembly for Java to seamlessly insert one PDF document into another. Get precise results with flexible and reliable tools.

Steps to insert a document into a PDF file

GroupDocs.Assembly makes embedding one PDF document into another simple and customizable.

  1. Create a template with placeholders for the embedded content (PDF templates are not supported).
  2. Specify the file path for the template.
  3. Provide the file path for the document to embed.
  4. Save the final file with the merged content as a PDF.
// Use this tag in your template to mark the spot for the embedded document
// <<doc [doc_expression]>>

// Set the file path for the main template
// PDF templates are not supported at the moment.
String template = "doc_template.docx";

// Provide the path to the document you want to insert
DataSourceInfo data 
    = new DataSourceInfo("insert.docx", "doc_expression");

// Save the final file with the embedded content
DocumentAssembler asm = new DocumentAssembler();
asm.assembleDocument(template, "result.pdf", data);
Maven XML
click to copy
copied
More examples Documentation

Advanced tools to simplify document integration

With GroupDocs.Assembly for Java, embedding documents is straightforward and customizable, no matter the file type. Achieve clean and consistent results across your projects.

Highlights of GroupDocs.Assembly

Create reports using business data

Fill documents with data from sources like JSON, XML, or CSV quickly and reliably, streamlining your workflows.

Enhance documents with visual content

GroupDocs.Assembly lets you insert tables, charts, and lists alongside text, hyperlinks, images, and even dynamic barcodes.

Place data exactly where it belongs

LINQ templates help position your data with precision, handle repeating elements like arrays, and apply custom styles effortlessly.

Compatible with diverse file formats

Merge documents across various formats, including PDFs, HTML, MS Office files, and OpenOffice, ensuring flexibility for your projects.

How to programmatically insert an image into a document

This example shows how to embed an image into a PDF file using GroupDocs.Assembly.

Java

// Add a placeholder tag in the template file
// <<image [expression]>>

// Define the path to the template
// PDF templates are not supported at the moment.
String template = "template.docx";

// Specify the path to the image
DataSourceInfo data =
    = new DataSourceInfo("logo.jpg", "expression");

// Initialize the DocumentAssembler instance
DocumentAssembler asm = new DocumentAssembler();

// Save the file with the embedded image
asm.assembleDocument(template, "result.pdf", data);
Maven XML
click to copy
copied
More examples Documentation

What is GroupDocs.Assembly for Java?

GroupDocs.Assembly for Java is a versatile solution for handling documents. It enables you to integrate one document into another with ease, supporting over 50 formats such as PDFs and MS Office files. Tailor your output by merging, editing, and organizing content exactly how you want.
Learn more
About illustration

Ready to get started?

Download GroupDocs.Assembly for free or get a trial license for full access!

Useful resources

Explore documentation, code samples, and community support to enhance your experience.

Key capabilities at a glance

Discover the extensive features GroupDocs.Assembly offers to make embedding and combining documents efficient and hassle-free.

Merge across different document types

With Java, you can embed and combine content across more than 50 file formats. Add files seamlessly to create professional results.

Temporary license tips

1
Sign up with your work email.
Free mail services are not allowed.
2
Use Get a temporary license button on the second step.
 English