Windows 8, Print to PostScript printer to file - file-io

Am I missing something stupid simple?
I have a new Windows 8 machine... 64-bit.
From an app on my old machine, I generate report output to a "Generic PostScript Printer" which is configured to be sent out to FILE (not LPT, COM, TCP/IP).
While trying the app, it fails to generate the output to the text file provided.
So, I'm taking my application out of the equation. I just go to control panel, pick this printer and tell the Windows printer dialog to do a test print. It comes up with a dialog to enter the file name and I put it into a folder that I have full permissions to... It fails... I even tried as "Administrator" to remove any possible "permission" issues and it still fails.
What am I missing on something that should otherwise be so simple, that even MS dialog / test print doesn't work.
To clarify what I DID do..
Control Panel - get to devices / printers
Add Printer -- clicked on the "printer not found"
Radio for "Add a local printer or network printer..." -- next
Use an existing port -- FILE: (Print to File) -- next
Manufacturer - Generic -- Printers - Generic XPS Class Driver (A) -- next
(used the driver already installed since I tried previously) -- next
Printer name: -- left alone by default of "Generic Color XPS Class Driver (A) -- next
Do not share this printer -- next
Print a test page -- dialog defaults to "Libraries\Documents\", I entered myTest.prn -- Save
It APPEARS to generate the file... however, it only creates the file as a zero-byte size

UPDATE... While digging and struggling, I actually opened a support ticket with Microsoft. They have confirmed that this specific process IS a bug and will be working on a patch (to be delivered with other patches when ready).
ANOTHER UPDATE !
Apparently, the machine I bought from DELL only had Windows 8 BASIC version. Through many support calls back and forth, it is a specific issue when trying to use certain printer drivers (such as Microsoft PS Color Printer -- for Post-Script output), from the default drivers provided with new machines with Windows installed.
OUR WORK AROUND.
For grins, I ultimately went out to HP's website (how common are HP printers :), and downloaded the printer driver for a 2500 LaserJet and install THAT version of PostScript printer. After installing that, and trying the output, I can generate the output to a textfile without problem... even when default setting is to LPT1: and being redirected to an output text file for postscript content.
So, ultimately, issue resolved by using ANOTHER Vendor's printer driver for postscript printing and I'm good to go.

Related

Converting Windows .PRN file (PCL) to PDF

I have been succesfully capturing PCL content sent by old machinery to a parallel port and converting it to PDF using GhostPCL for a while.
However, we have some older industrial machinery which is based on Windows 2000 and outputs to a HP Laserjet printer via the parallel port. Unfortunately, the software on the machine does not allow additional software or printers to be installed.
The problem is that whilst the captured output appears to be PCL graphic data, I have not found any tools which can convert it - GhostPCL attempts, and you can make out the text a little, but it is completely corrupted.
The captured output results in the output from GhostPCL
I can see that the captured output starts with:
ESC E (PCL command for Reset)
ESC &l0L (PCL command to disable skip perforation)
ESC &r1U (*** UNKNOWN ***)
ESC &l1H (PCL command to Feed from tray 2)
ESC *o0M (*** UNKNOWN ***)
ESC &126A (PCL command for A4 portrait paper)
ESC *g8W (PCL command to configure raster data - 8 bytes)
I can see that the captured output has some PCL codes which do not appear in the official documentation, which results in the weird characters at the start of the PDF.
Does anyone know how to convert this file to PDF ?
Your description shows an attempt to read a language different to pcl, so was the older system designed to talk to a default printer using Epson ESCAPE encoding. so its a dot printing file that the hardware will position those dots in the correct place and pressure, you could try converting to a bmp then massage the image into a pdf page.
You say an HP is connected but is that the true capture of what it is agreeing to use at runtime?
For example If I attempt to save my HP inkjet print file at time of printing I will get a PDF ! but why since the printer normally cant handle those direct?
What may I find If I look and see the default printing language is not set to a PCL or a PJL one.
There are many pcl language variations so a PRN file ideally should have some compatibility declaration such as #PJL ENTER LANGUAGE = PCLXL ) HP-PCL XL;2; Note this is NOT an HP printer just one that declares the following code will be HP style.
The printer can accept many formats and the system can produce many different formats for one printer. Thus you need to check all the system settings to understand what language is actually in run time use. Are you sure that .PRN is a full load of the conversation between the system & printer as print to file is not always the expected 2 way code.
The best way to ensure you capture true printer driver output is to change the drivers output PORT to a fixed filename and ideally use the correct format extension NOT unspecified .prn or .pcl if it is not such.

Force a webbrowser to display a PDF file only on Adobe Acrobat Reader

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.

Intellij print all classes as PDF

My professor wants to get the code of my Library Management project not only as .java files but also as a one PDF file. Is there any way to do that in Intellij? I have a lot of classes, and I would like to avoid having to click and print every one of them separately.
Is there any workaround? I am using Mac OS. If I select the folder where the code is, the print button shows greyed out.
Select the directory that contains all of your source code. If your code is scattered around different directories you will have to either print it in batches or drop all the files you want to print into one temporary folder and select it.
Click File -> Print.
In the menu that pops up select All files in directory option. This help page explains all the options in this menu. Click Print.
To save all the code as PDF instead of your physical printer select a virtual PDF printer. Windows 10 has "Microsoft Print to PDF" installed by default. If you don't have one, you can pick one for your OS on this Wikipedia page
Set up a fictional printer on your mac.
Go to printers and scanners in system preferences.
Add a new printer.
Click the globe(network) icon.
Address: 0.0.0.0
Protocol: Airprint
Use: Select Software -> Epson 24-pin series, or whatever you feel like
choosing
Add. Continue to add although warnings are displayed.
Now, you can "save to pdf" from IntelliJ Idea—no more weird errors.

BIRT report output not visible in "view report as PDF" option

I have recently installed BIRT in a 64 bit windows 8 machine. When I view a report in HTML output or any other output the report is visible just fine. But when I chose to view it as PDF , a blank page opens with a small cross on top left corner and nothing else. (attaching screen shot)
I tried opening the same report on other machine (Windows 7) with BIRT "view as PDF" and it works fine.
I have checked opening other pdf files on my machine, they open perfectly OK. Is there any other setting I need to do in other to make the pdf output of report visible or is it a bug with windows 8 64 bit version.
Version Details
BIRT : Version: Helios Service Release 2
Build id: 20110218-091
Adobe
Version 11.0.3
Thanks for your help...
This looks like a moderately complex report. Try to narrow the possiblities by creating a very simple report with only a lable "test" and see if it opens in PDF on your 64 bit windows 8 machine. If it does then you know, there is something in your report blocking the PDF, if it does not then you have pretty much proven it is a bug with windows 8 64 bit version.
If your simple report works, you will want to begin recreating your complex report one peice at a time, and testing it, with each new element. When it stops working you will know what breaks it.
I had this problem and the solution that worked for me was to:
- click on Window->Preferences
- click General->Web Browser in the navigation pane
- select use external web browser and pick the external browser of choice
- hit apply, ok
I had the same issue and was able to resolve it by installing the Adobe Reader. Previously I had only an alternative PDF reader (Foxit) installed. After I installed the original Adobe Reader, the "View Report As PDF" menu item worked as desired. Setting the Adobe Reader as the default PDF viewer was NOT required.
Maybe re-installing the Adobe Reader in the latest version and with default settings does the trick for you?

transparent pdf printing/preview in VB6

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