0

I am integrating a shipping company's API with our business software. Their API returns a web address with the PDF file, which is a shipping label that we just purchased through the API. So something like... https://example.com/file.pdf

I need to embed, or place, or something the pdf file on a webpage.

The PDF is just one page and only a 4x6" label.

I have used iFrame and it displayed, although ugly. I tried embed and object also and they also both worked.

The problem with all of these is that although I can see the label on the page, I cannot print it. When I go to print preview, I never see the label and it never prints.

I want to be able to place the image of the shipping label on the page and place several other elements too such as a receipt, message, etc. Then we will peel off the label and put the rest of the paper with the package.

I would prefer to do this without having to download the file anywhere and do any type of conversion because I know that will make things very difficult as I am basically a beginner. But I will if that is my only options.

SURELY there's an easy way to give the URL and then it give you a different URL of that PDF that's been converted to an image.

Or maybe I am asking too much...

Any help would be greatly appreciated!

I am using PHP, JS, JQuery, HTML, CSS

1 Answers1

0

Reposting from this answer: https://stackoverflow.com/a/4854037/1027624

I use Google Docs embeddable PDF viewer. The docs don't have to be uploaded to Google Docs, but they do have to be available online.

<iframe src="http://docs.google.com/gview?url=http://path.com/to/your/pdf.pdf&embedded=true" 
style="width:600px; height:500px;" frameborder="0"></iframe>

In this way you can directly use the API's returning web address.

Mattia Monari
  • 158
  • 1
  • 3
  • 9
  • Does NOT work. Tried it yesterday too. Tried it again now with your code. Says Preview not available. Same as yesterday. At least the iframe vanilla version and object and embed showed up... This, I get nothing. –  Dec 03 '20 at 19:12