Blitline supports importing PDFs and turning them into images:
- You can import it and turn it into a giant tall image (with all the pages layed out vertically).
- You can import multiple individual pages of a PDF and perform image operations on those.
- You can import all the individual pages and have a batch of functions performed on each of those items.
Import entire PDF as one large image
You don’t have to do anything special, just make your "src" point to a ".pdf" file and Blitline will automatically recognize it, and convert it into a large image. From there you can perform operations on it as you would any other image.
Or...
Import all the pages of the PDF and process each
You must add an "src_type" field to the json indicating that you are processing a multi-page document. The value for "src_type" must be "multi_page". When set to "multi_page" blitline will load the PDF and perform all the subsequent Blitline operations on each page. The output from Blitline (via the "save" field) will generate a file with an underscore and page number appended to it.
"json" : '{ "application_id": "YOUR_APP_ID",
"src" : "https://s3.amazonaws.com/bltemp/non_stock_bulk_sell_sheet.pdf",
"src_type" : "multi_page",
"functions" :
[{
"name": "resize_to_fit",
"params": { "width" : 200, "height" : 200},
"save" : {
"image_identifier" : "external_sample_1"
}
}
]}'Remember: The output filename will have a _0 and _1 appended to it, representing the page number that the image was taken from. So for the example above, the output filename might be something like "EDePXXSiljSVBvHi42o3sg.jpg", but the outputted files will be "http://s3.amazonaws.com/blitline/2012081421/20/EDePXXSiljSVBvHi42o3sg_0.jpg" and "http://s3.amazonaws.com/blitline/2012081421/20/EDePXXSiljSVBvHi42o3sg_1.jpg"
Or...
Import specific pages from a PDF
You must add an "src_type" field to the json indicating that you are processing a multi-page document. The value for "src_type" must be a json hash of { "name" : "multi_page", "pages" : [0,1]}
This behaves the same way as the default "multi_page" abovem but only performs the operations on the pages identified by the "pages" array.
"json" : '{ "application_id": "YOUR_APP_ID",
"src" : "https://s3.amazonaws.com/bltemp/non_stock_bulk_sell_sheet.pdf",
"src_type" : {"name" : "multi_page", "pages" : [0,1]},
"functions" :
[{
"name": "resize_to_fit",
"params": { "width" : 200, "height" : 200},
"save" : {
"image_identifier" : "external_sample_1"
}
}
]}'Remember: The output filename will have a _0 and _1 appended to it, representing the page number that the image was taken from. So for the example above, the output filename might be something like "EDePXXSiljSVBvHi42o3sg.jpg", but the outputted files will be "http://s3.amazonaws.com/blitline/2012081421/20/EDePXXSiljSVBvHi42o3sg_0.jpg" and "http://s3.amazonaws.com/blitline/2012081421/20/EDePXXSiljSVBvHi42o3sg_1.jpg"