Skip to content

Commit 51ecb39

Browse files
committed
For LDEV-5819, added action=extractimage for <cfpdf> to match ACF
1 parent cc1d86a commit 51ecb39

File tree

2 files changed

+18
-0
lines changed

2 files changed

+18
-0
lines changed

source/java/src/org/lucee/extension/pdf/tag/PDF.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -312,6 +312,7 @@ public void setAction(String strAction) throws PageException {
312312
else if ("extract_text".equals(strAction)) action = ACTION_EXTRACT_TEXT;
313313
else if ("addheader".equals(strAction)) action = ACTION_ADD_HEADER;
314314
else if ("addfooter".equals(strAction)) action = ACTION_ADD_FOOTER;
315+
else if ("extractimage".equals(strAction)) action = ACTION_EXTRACT_IMAGES;
315316
else if ("extractimages".equals(strAction)) action = ACTION_EXTRACT_IMAGES;
316317
else if ("extract-images".equals(strAction)) action = ACTION_EXTRACT_IMAGES;
317318
else if ("extract_images".equals(strAction)) action = ACTION_EXTRACT_IMAGES;

tests/LDEV3048.cfc

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -111,6 +111,23 @@ component extends="org.lucee.cfml.test.LuceeTestCase" labels="pdf" {
111111
});
112112

113113
});
114+
115+
// Additional test case for LDEV-5819 to verify extractImage as the default action as like ACF
116+
describe( "testcase for LDEV-5819", function() {
117+
it( title="cfpdf extractImage, pdf with 2 images, 1 per page", body=function( currentSpec ) {
118+
pdf action="extractImage" source="#outputDir#withImages.pdf" pages="*"
119+
overwrite="true" format="png" imageprefix="two-image" password=""
120+
destination="#outputDir#";
121+
122+
var imageFiles = directoryList( path=outputDir, filter="two-image*.png" );
123+
124+
expect( len( imageFiles ) ).toBe( 3 );
125+
var imgInfo = ImageInfo( outputDir & "two-image-1.png" );
126+
expect( imgInfo.height ).toBe( 111 );
127+
expect( imgInfo.width ).toBe( 111 );
128+
129+
});
130+
});
114131
}
115132

116133
function afterAll() {

0 commit comments

Comments
 (0)