Skip to main content
Solved

PDF to BMP to Base64

  • July 1, 2022
  • 6 replies
  • 196 views

deanhowell
Influencer
Forum|alt.badge.img+24

I have a series of PDF documents that contain a map that came from the ArcGIS Map Series tools (over 2000 in all). I am reading each of the PDF's in and converting to BMP and saving the images to a local drive so I can use the images in a HTML report.

 

Rather than store the images locally, I was wondering if there was a way to convert the images to base64 and save the base64 as an attribute and then just use that attribute in the HTML document?

 

Is this possible? Any suggestions would be very much appreciated.

Best answer by ebygomm

The RasterExtractor will give you the raster as a blob

This post is closed to further activity.
It may be an old question, an answered question, an implemented idea, or a notification-only post.
Please check post dates before relying on any information in a question or answer.
For follow-up or related questions, please post a new question or idea.
If there is a genuine update to be made, please contact us and request that the post is reopened.

6 replies

nielsgerrits
VIP
Forum|alt.badge.img+60
  • 2937 replies
  • July 1, 2022

Hej Dean, not sure what you want to solve exactly. You already know you can add an image as base64 in an HTML report, right?


deanhowell
Influencer
Forum|alt.badge.img+24
  • Author
  • Influencer
  • 315 replies
  • July 1, 2022

Hej Dean, not sure what you want to solve exactly. You already know you can add an image as base64 in an HTML report, right?

Thanks @nielsgerrits​ I want to be able to use the base64 image in the HTML report rather than link to a file. So, I want to try and figure out how to extract the image from the PDF and convert it to base64 without having to save the image locally.


nielsgerrits
VIP
Forum|alt.badge.img+60
  • 2937 replies
  • July 1, 2022

Thanks @nielsgerrits​ I want to be able to use the base64 image in the HTML report rather than link to a file. So, I want to try and figure out how to extract the image from the PDF and convert it to base64 without having to save the image locally.

I don't know if that is possible. When I do this kind of job I use the TempPathnameCreator to create the files and point the HTMLGenerator to those temp files to convert it to Base64. But with 2000 bmp's and 2000 html's I can imagine the volume might be an issue. I would maybe use a workspacerunner to be sure the process runs one by one and clearing the tempfiles in between.


deanhowell
Influencer
Forum|alt.badge.img+24
  • Author
  • Influencer
  • 315 replies
  • July 1, 2022

Thanks @nielsgerrits​ I want to be able to use the base64 image in the HTML report rather than link to a file. So, I want to try and figure out how to extract the image from the PDF and convert it to base64 without having to save the image locally.

Thanks @nielsgerrits​ ​


ebygomm
Influencer
Forum|alt.badge.img+44
  • Influencer
  • 3422 replies
  • Best Answer
  • July 1, 2022

The RasterExtractor will give you the raster as a blob


deanhowell
Influencer
Forum|alt.badge.img+24
  • Author
  • Influencer
  • 315 replies
  • July 2, 2022

The RasterExtractor will give you the raster as a blob

Thanks @ebygomm​ that is a great option. I then added the binary encoder to convert to base64 which is stored as an attribute to be used in the HTML report.

image