Display pdf in iframe using ssl/https based - pdf

I want to Showing PDF inside iframe for user preview before download the file or print,
i use byte array convert my report file to pdf then showing it.
everything was perfect until i need something in ssl/https.
because of that i must change my application to ssl/https can some one show me how can i show pdf in this condition.
thanks for listening and reading my prob.
here my code
reportDocument.Load(reportPath);
reportDocument.SetDataSource(dataSet);
_contentBytes = StreamToBytes(reportDocument.ExportToStream(ExportFormatType.PortableDocFormat));
.....
//setting header
.....
//then flush
stream.Flush();

i found the solution in
PDF conversion suddenly fails if reading stylesheet from SSL
the problem is the pdf reader inside my chrome browser.
so i updating my chrome reader in store search pdf viewer..
just it..

Related

Android camera, take picture(s) and save as multipage PDF, then upload to server via <input type="file" />

I have a webform with and want to open it on smartphone - than take pictures of some documents which need to be merged in one PDF, and on the end this file need to be uploaded to server.
My solution is to use Google Drive to upload PDF (scan) to GDrive and then somehow download this file from gdrive to server via some sort of widget (any links appreciate) installed on website.
Maybe someone have a better idea?
I know its late but my answer might help others. I also face the same challenge and implemented a custom solution based on Javascript and Since you are using web form so this solution will perfectly fits on your need.
You have to use JSPdf javascript library, JSPdf provide you pdf object in your browser and you can upload it download it and there are many other thing to play with.
First you have to initialize JSPdf object as per your requirement. I am creating PDF with page size width:500px and height 500px.
pdf = new jsPDF("l", "pt", [500,500]);
Simply when you will take picture from camera you will have each picture in form of base64, that base64 format you have to insert in JSPdf object
pdf.addImage(imgData, 'JPEG', 0, 0);
you can repeat the above code to add pictures from camera as much as you want, at the back-end these images are compiling and creating pdf document where each page have each images in sequence.
Once you are done, you can get PDF object in form of base64 object using below code that you can upload to any server.
pdf.output('datauristring')
above is only pdf part, you can find complete working example including camera part here Javascript Component to Scan Document

Displaying the contents of a PDF file on the page using Coldfusion

I have a page that is dedicated to the Standard Operating Procedures (SOP). I want this page to show the the SOP in the page with a download button above it (and for Admin an upload button). Basically I want the user to be able to read the SOP without having to download it. I have the buttons sorted and I almost have the display set, but the format is off.
The admin can upload a PDF of the current SOP. That file then gets stored and overwrites that last upload. I tried using cffile but it was unreadable no matter what charset I tried to use. Currently I am taking the file and extracting it as a .txt, then using cffile to read it to a variable that I then output to the screen. It sort of works, but the formatting is all wrong.
I know I can use cfcontent and just have the page be the PDF, but I'd rather not have to mess with adding a new page just for admins to upload new SOP files. (The way the site is built it would have to be a new page)
<cfpdf
action="extracttext"
source="D:\file_path\SOP.pdf"
overwrite="true"
honourspaces="true"
type="string"
useStructure="true"
destination="D:\file_path\SOP.txt">
<cffile
action="read"
file="D:\file_path\SOP.txt"
variable="dcnSOP">
...
<cfoutput>#dcnSOP#</cfoutput>
Basically I'm getting a block of unformatted (as in spaces and new paragraphs) text. It's the text I want, and It's on the page where I want it. But it looks terrible. It seems to just be getting rid of any new line characters and just presenting the text in a blob. Is there a better way of doing this without just having the whole page be the PDF using cfcontent?
Thanks to #Miguel-F and #Ageax for the suggestions and leading me to a question I missed on here when I was searching for the answer.
<embed src="\file_path\SOP.pdf" width="800px" height="2100px"/>
This works with every browser but Chrome (our clients will not be using mobile browsers). I know you can use Google's PDF reader to get around this, if anyone is interested in that here is an example of that given by #Script47 here:
<embed src="https://drive.google.com/viewerng/
viewer?embedded=true&url=http://example.com/the.pdf" width="500" height="375">

Show PDF in a Vaadin View

I want to show a PDF in a Vaadin view. I create a BrowserFrame and I pass the StreamResource of the PDF:
StreamResource streamResource = new StreamResource(
getPresenter().createPdfStreamSource(), report.getName() + ".pdf");
BrowserFrame pdf = new BrowserFrame(null, streamResource);
pdf.setSizeFull();
content.addComponent(pdf);
This code creates an iframe with the following source:
http://localhost:8080/my-app/vaadinServlet/APP/connector/0/134/source/mypdf.pdf
If I point the browser to this URL, it shows the PDF properly. However in my application the PDF view doesn't show. What am I doing wrong?
I am testing this in Google Chrome.
Edit: I downloaded the plugin PDF Viewer based on PDF.js and my app works fine. Does the Chrome PDF reader plugin need special configuration?
An iframe is probably not the best option to render a PDF, especially on mobile browsers. Check the WT PDF Viewer add-on which is based on pdf.js for a more compatible solution.

About how to upload PDF file and show it

I can't figure out how to do like this page http://service.citroen.com/ddb/modeles/c5/c5_c5/ed10-07/de_de/4_21_c5-al-ed10-2007.pdf I embed usually the PDF from slideside in my site but people cant dowload from because they need to have an accoount. So technically how ? Thanks
You will need a PDF viewer component for displaying the PDF. You will have to configure the PDF component so as to limit download and print options.
http://www.gnostice.com/nl_article.asp?id=329&t=Display_PDF_without_saving_file_to_disk_in_WinForms_and_ASP_NET

XPage - Open scans in browser

I need to display uploaded scans (JPG, PNG, TIFF, PDF, etc.) in the browser's window instead downloading them to a local pc and using external apps like Acrobat Reader.
I made some research in the web on that issue but wasn't really successful.
Does anyone have hints, code snippets, how to achieve that ?
EDIT :
Since I am not looking for a solution which supports viewing scans in a typical browser like Chrome, FireFox, etc. but supports viewing scans in an XPage view within Notes I need to ask my question again.
What is the best (recommended) way to view different types of scans, uploaded as PDF, JPG, TIFF, PNG, etc., in Notes within an XPage view ?
Take a look here, XPages: Embed PDF and possibly Office files
Here is some code that I have in an app for PDF's.
I tried using Bumpbox, and pdf.js and while I could get them working, iframes seemed to work best for me with using normal Domino attachment urls in xpages
I am not sure if this solution is right or not, but it works well for an app I have that only has PDFs. It does work on mobile too, at least on iOS.
<iframe
src="#{javascript:
var url = 'https://app.nsf/';
var doc = sessionScope.docID;
var atname = #RightBack(sessionScope.aname,'Body');
var end = '/$file'+atname;
return url+doc+end}"
width="800" height="1000">
</iframe>
If you are looking at using different file types you need to use a renderer, give it the attachment URL, and then display what the renderer returns with. I haven't looked at this in a while so things might have changed. Look for a lightbox clone that can display pdf. I think Orangebox was one, bumpbox looks to not be updated but I was able to get that working for me.
This method will display everything inline. I would love to see some type of renderer like pdf.js for xpages.