Skip to content

Commit

Permalink
Added a fix: cfpdf action="addHeader/addFooter" with destination attr…
Browse files Browse the repository at this point in the history
…ibute throws the correct error (#51)
  • Loading branch information
cfmitrah authored Sep 14, 2023
1 parent 15bd7da commit 0e75732
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions source/java/src/org/lucee/extension/pdf/tag/PDF.java
Original file line number Diff line number Diff line change
Expand Up @@ -750,6 +750,9 @@ else if (destination != null) {
private void doActionAddHeaderFooter(boolean isHeader) throws PageException, IOException, DocumentException {
required("pdf", "write", "source", source);
if (text == null) throw engine.getExceptionUtil().createApplicationException("when PDF action is [addHeader or addFooter], It requires a attribute [text]");

if (destination != null && destination.exists() && !overwrite)
throw engine.getExceptionUtil().createApplicationException("Destination PDF file [" + destination + "] already exists");
// required("pdf", "write", "destination", destination);

/*
Expand Down Expand Up @@ -784,9 +787,6 @@ else if (destination != null) {
}
PdfStamper stamper = null;
try {
if (destination != null && destination.exists() && !overwrite)
throw engine.getExceptionUtil().createApplicationException("Destination PDF file [" + destination + "] already exists");

int len = reader.getNumberOfPages();
Set<Integer> pageSet = PDFUtil.parsePageDefinition(pages, len);
stamper = new PdfStamper(reader, os);
Expand Down

0 comments on commit 0e75732

Please sign in to comment.