I am working on a legacy app in VB6 and am wondering what the easiest way would be to implement this requested feature - client wants ability to preview a document being sent to the printer as a PDF. No problem - there are plenty of PDF printer drivers out there that one can use. However, a necessary condition of this feature is absolute transparency - in other words, it should work out of the box after installation of the app, without having to say "To use this feature go to such-and-such website and download this pdf printer driver." In addition, client does not want to see a "Save As..." dialog. The ideal function of the feature is that a button is clicked, and what would have been sent straight to the printer is instead instantly previewed as a PDF that pops up with no further interaction with the user other than the user's initial pressing of a button.
Of course, there are a gazillion PDF packages out there, but they all seem to be along the lines of "here's an API where you can generate PDFs by directly writing lines, circles, graphics, text in specified fonts right to the PDF file". I do not want this - I want something that takes the data that is going right to the printer and pop it up as a PDF without a Save As
Now, CutePDF seems to have something like what I am looking for with their Custom PDF Writer (http://www.cutepdf.com/Solutions/pdfwriter.asp), but a) they do not seem to have an evaluation version; b) they do not seem to have much documentation about it that I can see, and c) it's freakin' expensive
Does anyone know if anything else like CutePDF Custom PDF Writer exists, or is that the only one of its type? I am open to any software as long as it gets this done, be it commercial, shareware, open source, whatever, so long as it satisfies the requirements of:
Must be a PDF printer (i.e. take the data going to the printer and turn it into a PDF)
must be completely transparent to end user (i.e. user must not have to change their printer settings and then change them back, or deal with a Save As dialog and then open the file they saved - it needs to just pop up)
must work with VB6
must be able to be packaged and installed along with the app without the end user having to run another setup program
any ideas?
Thanks in advance :)
We've started using Bio PDF Writer, available here: www.biopdf.com.
It does offer the ability to silently install (which we do). It also offers the capability to write out to a pdf file silently, requiring an ini file to be created first to do so.
However, it is more expensive for a site license than CutePDF is (1,499 vs 299/499). you can buy a single license for 29.99 (USD). This may cover their needs (if it is just one client). Their documentation is pretty decent and they do have a trial version (that, as far as I can tell, has no limitations to it).
You should be able to use any PDF printer software that provides a silent install option and just set the current printer when you need to print via PDF:
Dim oldPrinter as VB.Printer
Set oldPrinter = Printer
Dim p as VB.Printer
For Each p In VB.Printers
If p.DeviceName = "PDF Printer Name" Then
Set Printer = p
End If
Next
' Print Document Here '
Set Printer = oldPrinter
Note: You will need to ensure distributing and installing isn't in violation the license agreement
Related
I am generating various invoices, shipping manifests and similar documents via QRPs from an ERP program written in TD 4.1.
When my customer just prints these regularly from the program to a normal printer, they come out fine.
The customer also prints them to PDF via FreePDF XP, this happens from the printing dialogue (FreePDF XP being selected as a printer).
This results in part of the right side and the footer being cut off.
Format-wise, the reports are using Paper Style A4, page margins are top=0.8, bottom=0.85, left=0.95, right=1.0. The PDF printer is also set to A4, but has no margin settings available.
I'm grasping for straws here, but is there any way I can make this work from within the report or possibly programmatically, or is this purely on the printer driver side?
Oh, decreasing the width/height is not an option for these documents, sadly.
Pity you don't use a newer version. With TD5 and newer you can create PDFs with the integrated Report Builder, so you don't need any 3rd party tool.
Couple of ideas:
SalReportPrintToFile() and eMail the file.
SalPrtSetParmNum( PRT_nMarginTop, nMargin) ( i.e. adjust the margins via TD app for PDF's )
Have a separate .qrp for PDF's with the larger margins already preset in the qrp.
Is it possible to try the output on another pdf printer as well ? If possible try the output on another pdfprinters like PDF24Creator also.
If available in version version 4.1, have a look on SalReportSetPrinterSettings( ) function and its parameters.
bOk = SalReportSetPrinterSettings (hWndReport, strPrinterName, nOrientation, nPaperType, nWidth, nHeight)
SalReportSetPrinterSettings function sets the printer properties at runtime. The function can be called from the message action of SAM_ReportStart message.
Passing an invalid value in a parameter causes that parameter to be ignored, and the default setting will be used instead.
3.If feasible can try third party paid tools like BullZipPDFPrinter.apt that you can be intagrate with TD.
I create a PDF with iTextsharp and then I show the preview of the PDF inside a webbrowser control. From the preview the user can SAVE or PRINT using the defaults Adobe Reader's buttons
Working on Windows x64 bits with Adobe Reader as the default PDF viewer everything works fine.
The same program on a Windows x64 bits but with Foxit Reader as the default PDF open the file on Foxit Reader on full application window, outside my program.
I need to manage that.
My code is like
Dim PathToPDF As String
PathToPDF = DirectoryOfMyApp & "\ReportPreview.pdf"
ReportPreviewWebBrowser.Navigate(PathToPDF)
Where DirectoryOfMyApp just gets the C: or D: letter of the hard disk.
I read this link
How to start an Adobe Reader or Acrobat from VB.NET?
but a line like
ReportPreviewWebBrowser.Navigate("acrobat", PathToPDF )
didn´t work and I think the webbrowser control don´t have the option to choose the PDF viewer
https://msdn.microsoft.com/es-es/library/system.windows.forms.webbrowser(v=vs.110).aspx
Is there a way to set the webbrowser to use Adobe Acrobat Reader only or to force any other PDF viewer to show the PDF inside the webbrowser control?
I agree with Zaggler on his comments on this. You are making assumptions at a certain point on software that is installed on an end user's computer. Unless you are going to make the application's PDF viewer be part of a dependency installation or cooked into .NET you cannot guarantee they have that program to use. Nor can you guarantee it's installed location.
However there is a cheap hack for Windows based processes you can do in VB.NET. You can use the ole System.Diagnostics.Process()
Sub Main()
Dim nProcess = New System.Diagnostics.Process()
nProcess.Start($"D:\PdfFile.pdf")
End Sub
In this example I did a quick file location, you can try to ensure it is a valid location that will not change or is in your app's running process folder. This is really low tech as far as development goes, but it is basically saying: "Run me a process, any process, at this location. I don't care what it is, use the Windows defaults to determine what to do with it."
So when I run this on my Windows 10 Dev box it loads up Edge to display it, at home it would fire up Adobe Viewer. It is just opening the file essentially with the OS's choice of what is using that file extension. Not glamorous or very good for hardened code but it works when you want something quick to happen.
No, you can't do this.
You can't even guarantee that Adobe Reader is installed at all.
Reader might not even exist on the machine. It's not built into Windows, and not everyone uses it. Even if it is, FoxIt isn't the only alternative. A big one is that Chrome includes it's own PDF viewer.
I'm using the Adobe Acrobat PDF Viewer ActiveX (AxAcroPDFLib.AxAcroPDF) control in one of my forms to display Controlled Document PDFs and my customer would like end users to not be able to print these documents. Is there anyway to disable printing through this control?
The PDF format supports permissions and "allow printing" is one of the permissions. If you can control the PDF generation of these controlled PDFs your best bet is to disable the allow print permission for users. You can also even run existing PDFs through a conversion process to add the necessary permissions with iText, ghostscript or something similar.
Besides, even if you are able to to disable the print button on the ActiveX viewer, if the user is clever enough to realize it is merely a PDF, they could just download the PDF and print it normally.
There's a new PDF software that does this by default. You would have to save the document as .wwf rather than .pdf. If the document is already in PDF format you can re-save it in WWF format.
It's provided by the World Wildlife Foundation in an effort to reduce paper use. The end user does not need to have the software installed on their computer for it to work. You can download the software for both MAC or PC from the link below. Hope this helps!
http://www.saveaswwf.com/en/
I've got a form that I downloaded, I'd like to prefill some content on the form (this is easy using cfpdfform).
Where it gets tricky is I would like to allow the user to modify the contents of that form, and then somehow have those modified contents accessible to me. I didnt build the source PDF so I dont know how to allow the user to "save" the new contents so they can be read.
Any ideas on where I might start on this one?
You can also use the cfpdfform tag to read/write data to a PDF file which has a form. The important thing is that the PDF document already have the form fields available, or that you add them.
I just recently completed a task where I had to have a user fill out a normal web form, and then create a filled version of an existing PDF document. It worked like a breeze!
I think that depending on what you are trying to accomplish, having the user fill out the data in a web form is less confusing than serving up a PDF and expecting them to save that to update a file on a remote server. Just my opinion, though.
http://www.cfquickdocs.com/cf8/?getDoc=cfpdfform#cfpdfform
It's possible for users to complete most PDF forms in Adobe Reader, but when user's try to save the changes they get a popup prompting them that the PDF cannot be saved and would need to upgrade to Adobe Acrobat to have this functionality.
Since Acrobat 7 (or possibly) 8 it's possible to create a form so that it can be completed and saved in reader. In Acrobat open your PDF, and select Advanced -> Enable usage right in reader from the menu. This will prompt you to save the form and then anyone using Adobe reader can complete it.
Once that's done you can open the form in ColdFusion, populate some of the fields and serve it up to the user. Once they fill it in, save it and get it back in ColdFusion you can read the contents using the PDF related tags.
Please note: It's currently not possible to set the "enable usage rights in reader" flag from ColdFusion, you need a copy of Adobe Acrobat or access to Adobe LifeCycle server to do this.
This document may help you:
http://www.adobe.com/education/instruction/teach/coldfusion/CF8-2_advanced_cf8_development_unit8.pdf
I am embeding a PDF form on my web application. The application allows you to fill in the fields in the form, and when you are done, click on a "Submit" button, which saves whatever you've entered into the form. This functionality is working fine.
Unfortunately, Adobe Reader displays a message on top of their embeded control that says: "Please fill out the following form. You cannot save data typed into this form. Please print your completed form if you would like a copy for your records."
Now, I know what Adobe Reader is trying to tell the user. Basically, Adobe Reader will not allow you to save the contents of what you've entered into your local hard drive as a new PDF.
However, since we've added a Submit button which effectively will save what they typed within our application, and it is working. Therefore, we think this message is misleading, and would like to remove it.
I use iTextSharp in .Net for our form automation server side. I have not found a way to remove this message from the embeded forms.
Any help?
It has been a long time, but adobe has added option to hide this annoying message.
On OSX 11.0.3, Preferences>Forms>Always hide document message bar
I'm pretty sure that there is no way around this if you want to continue to use Acrobat Reader to display the PDF. This message is built into Acrobat Reader, and I am not aware of any way to override it from the outside.
Sorry, this is more in the way of a negative answer than a positive one.
There are some third-party, free, projects that are basically PDF viewers for .NET. This would allow you to get rid of the message by avoiding Acrobat Reader entirely, although this is a large amount of work just to get rid of a message.
This one is pretty comprehensive.
Another option that I'm sure you already thought of is to just build the form on the web page, instead of using the PDF. Again, a lot of extra work just to remove a message.
Adobe Acrobat (Standard and Pro) can change PDF forms to enable Adobe Acrobat Reader users to 'fill+save' form data (instead of the standard 'fill+print').
It is a special option available when saving the PDF saying "Save PDF with extended Reader functions" (or similar... I'm translating this back from German into English).
This cannot be achieved with any non-Adobe PDF creating software (unless this has licensed that function from Adobe). The technical reason for this is that Adobe uses a digital signature to protect this function, and that you'll have to agree to not reverse engineer the key when you accept the Adobe EULA. Acrobat Reader has that key compiled into its binary, and if it verified the key, it will change the message displayed to the user indicating that the form data of this document can be saved (it will also change its behaviour and indeed save the data).
Maybe this info helps you?
Switch to View > Full Screen Mode (short cut is on a mac is ⌘L).
Although this mode hides all menus and scroll bars too, I prefer it. IMHO the reader uses far too much screen real estate on junk)