Open a responsive website then print to PDF - powerbuilder

Is there a way that I can open a series of webpage URL and loop to print it to pdf?
I tried creating a datawindow and adding ole object control for microsoft web browser, I set the ole object size to display because its responsive and so that I can get all the information before I print. But I am having problems printing the datawindow as it is printing a blank pdf.
Sample links:
just disregard the on demand app error.
Link1
Link2
Link3
Any help is much appreciated.

How about adding the Microsoft Web Browser control directly onto a window, load your page, then call the Print method on the ActiveX control directly? You'll need a PDF printer like PrimoPDF.

Related

Saving webpage content using webbrowser IHTMLDocument interface

We need to save the complete web page including img, javascript, css and html using ATL webbrowser (IHTMLDocument) control,
using IHTMLDocument2::get_all() method we have saved .html file but now how do we get external files such as .css, javascript and image files
please help us with methods that internet explorer or firefox used to save the web page locally.
Thanks,
Ramanand.
I think this will be a rather manual task:
You can get a grip on the stylesheets by using the IHTMLDocument2::styleSheets property. The collection contains IHTMLStyleSheet elements, which in turn have a href-property which you can use to download the file. Scripts you can get via IHTMLDocument2::scripts which gives you a collection containing IHTMLScript elements, which have a src property. Same goes for images: use the src property to obtain a path. Somebody seems to do the same thing as you, have a look here. There are also some hints about handling relative pathes.

Making content accessible on Addon SDK

I am developing an addon using Firefox's Addon SDK (v. 1.11). My extension dynamically creates an iframe on each website and then loads an html file which includes other resources such as images, font files, etc. from the add on's local directory.
Problem
When loading any of such local resources (i.e.: "resource://" schema), the iframe fails to display them and a message is thrown:
Security Error: Content at http: //www.XXX may not load or link to
resource://XXX
This is a security measure introduced on Firefox 3. When developing without the Addon SDK, the way around it is declaring a directory with "contentaccessible=yes", making the directory's contents accessible to anyone, including my add on. However, I have not been able to find similar functionality using the Addon SDK. Is there a better way of using local data on an iframe that my addon creates and inserts into a page?
I don't think you can directly load an iFrame that points to a resource inside your URL. The browser complains because it's either breaking same origin policy or cross site scripting one. I can't remember which one right now.
if it is html content you want to load you can always inject it into the DOM and then send a message to the document object using the events API to display your custom html. I've done this in the past and it works.
so from main.js send a message to content script which will then inject your iframe html into the DOM and then you can send the document object a message to display it.
I hope this helps.
Not sure if this was the case when you posted the question, but it appears that "resource://" should no longer be used with the Addon SDK.
If you're using the resource inside of an HTML file in the extension, you can reference it locally, otherwise you should use data.url('whatever.jpg') and pass around that value as needed.
Full info is here: http://blog.mozilla.org/addons/2012/01/11/sdk-1-4-known-issue-with-hard-coding-resource-uris/

Programmatically Print to PDF

I have a customer who wants to print to PDF and Physical printer at the same time. They don't want to print the physical copy from the PDF, why I don't know. I tried saving as a temporary RTF file and calling ShellExecute to print to Adobe but doesn't appear this works.
Does anyone have a way without a 3rd party PDF library to print to PDF from a file?
UPDATE: To clarify a bit the user is working with a dynamic document creator. They see preview text on the screen in a TRichEdit and the current print method is the TRichEdit's print command (RichEdit.Print). The first attempt to a pdf was by saving the contents of this rich edit to a temp.rtf file.
You can use our Open Source SynPdf library to export a RichEdit content into a pdf file.
See this forum post for some sample code.
It won't require any printer to be installed. And it will allow easy print preview, custom footer & header, additional title or text, if needed.
I have used PDFForge in the past. It installs a virtual printer, and printing into this printer creates a PDF. However, it also has options to also immediately print to a physical printer, hence you will be producing a PDF and physicall copy simultaneously. See documentation here if it help you:
http://www.pdfforge.org/content/print

Export Firebug Net Tab request?

I want to save the sequence of events and loading of resources on the webpage. Is there any way to export net tab web requests on Firebug ?
I found different ways to do this:
Firebug itself allows to copy the content on the net panel as an HTML table. The copy/paste functions work as usual. It is sufficient for exporting the summary shown in the net panel.
HTTPFox addon can do the same by using the Copy All Rows contex-menu option. This produces a tab separated format which works better with text editors.
NetExport Firebug extension adds export function to the net panel in Firebug. The data can be exported in HAR format which is used other tools or as JSON data. The online HAR Viewer allows to see the exported data as it was captured in Firebug.
I found that Firefox has addon HTTPFox, This allows many more functionalities to test HTTP web requests.
Please, Let us know if there are any more ways.

Open a pdf file inside a webview.

I have an app where I've button on a webpage that is rendered inside a webview.
Now on click of button , a pdf file gets downloaded , and the same would then need to be opened inside the same webview.
attach a download listener to the web view and change the url as follows..
"http://docs.google.com/gview?embedded=true&url=http://www.abc.com/xxxxxyyyyyxz.pdf"
it's a link used to open pdf without downloading it...
I hope it solves your problem..
I've found that the google viewer seems to work within the android browser for viewing online PDF files. You could build a link to your pdf so that it is displayed in the viewer. I've not tried doing that within a WebView though.
UPDATE
The link is dead, there is an explanation of how to get the functionality to still work at this link.
In case this link also dies, here is the relevant section:
While the page is no longer available as it redirects to Google Docs/Drive, you can still use the Google Docs Viewer. Paste this URL in a new tab:
https://docs.google.com/viewer?url=
and then paste the address of the document you want to view online. Here's an example:
https://docs.google.com/viewer?url=http://research.google.com/archive/bigtable-osdi06.pdf
I don't think any browser other than Chrome supports rendering PDFs without a plugin or third party tool. It's probably easier to let the user use his own app to open PDFs.
I used the IText PDF library mentioned in this thread
Android : Is there any free PDF library for Android for a sample project. You could try getting using this API to get the PDF page as an image. I am not familiar with every aspect of Itext so it might have better way to do this.
I do not think that the present android chrome based browser can support pdf. There are discussion about the same in android forums ( ex: link1 link2)
Your best bet to show pdf is to have adobe pdf reader for android installed.(or concisely put, not possible in web view)

Resources