Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 8 additions & 4 deletions pdfbox/src/test/java/org/apache/pdfbox/cos/TestCOSIncrement.java
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,8 @@

import java.io.ByteArrayOutputStream;
import java.io.File;
import java.io.OutputStream;
import java.io.InputStream;
import java.io.FileOutputStream;
import java.io.IOException;

Expand Down Expand Up @@ -311,12 +313,14 @@ void testSubsetting() throws IOException
document.save(baos);
}

try (PDDocument document = Loader.loadPDF(baos.toByteArray()))
try (PDDocument document = Loader.loadPDF(baos.toByteArray());
InputStream is = TestCOSIncrement.class.getResourceAsStream(
"/org/apache/pdfbox/resources/ttf/LiberationSans-Regular.ttf");
OutputStream os = new FileOutputStream("target/test-output/PDFBOX-5627.pdf"))
{
PDPage page = document.getPage(0);

PDFont font = PDType0Font.load(document, TestCOSIncrement.class.getResourceAsStream(
"/org/apache/pdfbox/resources/ttf/LiberationSans-Regular.ttf"));
PDFont font = PDType0Font.load(document, is);

try (PDPageContentStream contentStream = new PDPageContentStream(document, page))
{
Expand All @@ -333,7 +337,7 @@ void testSubsetting() throws IOException
pages.setNeedToBeUpdated(true);
page.getCOSObject().setNeedToBeUpdated(true);

document.saveIncremental(new FileOutputStream("target/test-output/PDFBOX-5627.pdf"));
document.saveIncremental(os);
}

try (PDDocument document = Loader.loadPDF(new File("target/test-output/PDFBOX-5627.pdf")))
Expand Down