Zero byte PDF saved when I use saveas in PowerBuilder web application - pdf-generation

I'm using PowerBuilder 12.5 nd installed ghostscript 9.19 version then I configured Sybase DataWindow PS printer using ghostscript driver.
I checked the registry it was pointing to the ghostscript DLL,bin and lib folders.
In datawindow painter window selected the PDF data export type,distill method and check the PostScript custom check box.
When I click save rows as in painter it is creating the PDF file with rows and also if I use dw_1.print the file was created in print manager without any issue.
But problem is when I use DW_1.saves("custom.pdf",PDF!,true) it is saving 0 bytes file in the file manger directory. Any suggestions?
I want save the datawindow in PDF format and it should be opened automatically because I don't want to go to print manager to print the file when I use print function.

Save the PostScript file and then run it through Ghostscript from the command line. Likely there is some error being returned which PowerBuilder isn't telling you.
Of course, you could also ask Sybase for assistance, since they supply it. Relying on open source software for their PDF export is (it seems to me) somewhat cheeky.....

You should use the Ghostscript that is provided with PB, using any other version is prone to fail...
For PB12.5, it is 8.71.
You can look at this other answer for further help: https://stackoverflow.com/a/15854193/317266

1.I Installed latest ghostscript driver and Mapped it as "Sybase DataWindow PS" Postscript Printer.
2. Then I used Distill method to save the datawindow in PDF format but saveas method returns -1.
3.In the IIS Manager -> Application Pools -> select PBDOTNETAPPPOOL -> go to advanced settings -> Navigate to process model and change the identity to Networkservice from applicationpoolidentity.
After that i'm able to save the datawindow in PDF format successfully!!!

Related

Font is not used when running as Windows Service

On a Windows Server 2019 I have a program running as windows service which runs a normal user.
That program starts another exe programm written in c# which uses a crystal report to create a pdf file.
The report uses a font called 39251 to display a code39 barcode.
But the generated pdf does not contain the barcode but instead the representing numbers (e.g. 838348348) It seems the report cannot find the font file or does not have access to it.
The service itself runs as the same windows user I use to login to windows.
But the weird thing is that when I run the program as user (not as service) then the exported pdf does contain the correct barcode.
I also changed the rights of the font file so everbody have full access to it.
Somebody an idea why the program cannot access the font when run as service but can access it when run manually.
right click on the font file and choose "Install for all users".
You'll be prompted for admin rights, click ok and this should solve your problem.

Own file extension - behaviour like picture in OS

I'd like to have my own file extension which holds my own data. With double clicking it will start with my own software. So far no problem.
How can i save a picture in that file (metadata?) in a way that it is shown in the OS (Windows, Mac) like a .jpg in the preview window (big symbols in windows, or in the window of the space key preview in macOS)?
The image is generated by my software and therefore is for the user to have a quick info of the internal data...
Thanks in Advance for your help!
Operating systems sometimes allow you to write plugins that read your file data and then convert it to a form that the OS knows how to display in a thumbnail. As for getting your file format to open in existing applications such as Photoshop, this will generally not be possible unless the application developers either choose to add support for your format themselves or allow you to write a plugin, which you will need to do yourself. Most existing file formats that are supported natively in operating systems and user programs have well-known, popular standards and users expect that their software will support these formats by default.

In DBF, "Ñ" character is showed as "¥"

I open a DBF file in Visual FoxPro and it shows "Ñ" character as "¥". I haven't created that DBF, I just open it and read it.
My question is: Is there any way to show those "¥" characters correctly in FoxPro? Or does it mean that this DBF file was created wrongly?
You probably need to know which encoding was used when the file was saved, depending on the version number of the file. Also the MSDN has a dedicated page about this topic. https://msdn.microsoft.com/en-US/library/5b10d8b6(v=vs.80).aspx
In specific the first paragraph might be for your interest:
When you create .dbf files, Visual FoxPro automatically gives them
code page marks so that you can tell which code pages they use.
However, if you use .dbf files from previous versions of FoxPro, they
might not have code page marks. You can determine whether a .dbf file
has a code page mark by using the CPDBF( ) function after opening the
file or by having Visual FoxPro check when you open the file.
You need to set the proper code page of your DBF file.
To know it, open the file with DBF Commander Pro, click 'Tools -> Set Codepage', then try to set the proper encoding by choosing various encodings from the list (leave 'Preview' check box turned on):
The program has 30-day fully functional trial period, so you can do your task at no charge.

How to update a PDF document opened in a viewer on Windows

I am writing a cross-platform application which generates PDF documents and then opens them with the standard PDF viewer. On Linux, updating (re-writing) an already opened document is no problem. The PDF viewer (have tried several) updates the displayed document after overwriting the file. I don't even have to trigger anything. This comes in very handy.
On Windows, however, I cannot overwrite a PDF document opened for reading by some viewer, because the viewers seem to open the document exclusively. Of course I cannot change the code of the viewers like Adobe Reader.
Is there any solution to this? I don't want to clutter the directory with arbitrary new file names, but rather use the same file name again. Deleting of the opened file is also forbidden on Windows.
I cannot determine which PDF viewer is used. In order to open the document, I use
cmd.exe /c start <fileName>

Redirect default program to another program when a file opens in Windows OS

This is only under windows env.
As I know windows os identifies associated application of a particular file by file extension.
Like wise each file (binary) starting with corresponding symbols ("starting symbols"). For an example .JPG starts with ÿØÿà. Let say I open this .JPG file in a Hex editor or a Text editor and then I change that starting symbols into another file type. for an example I can change ÿØÿà to .Eߣ (.mkv). So when I double click on the .JPG the Windows Photo Viewer says there are some errors or similar message. So I need to get some information about the application that tries to open that kind of a file. If I can, I need to open that file using the application that associated with "starting symbols".
Briefly when I open .JPG I need to open a default video player .mkv files. But It may not work for this example. Because I changed only the "starting symbols" of my .JPG.
Please give me any idea to do this.
Thanks!
When you encrypt the file, give it a new extension. e.g. Picture.jpg becomes Picture.encrypted-jpg. You then register as the handler for encrypted-jpg, decrypt the file, then launch the normal jpg handler.
When the shell is asked to perform a verb on a file, the shell does not use the contents of the file to determine which app to pass it to. The file extension is what determines how the file will be treated.
You wish to use the contents of the file to influence which app processes a shell verb. In order to do so you would need to create a launcher app that reads the file header and then decides which app to pass the file on to. You would assign your launcher app as the handler app for all file extensions that you were interested in.
Although you could do this, it would be much easier just to set the file extension appropriately.
The proper way to do this sort of thing is to replace the files with reparse points.
The downside is that this involves writing a file system filter driver, i.e., an operating system extension, which is a whole level of trouble above and beyond ordinary application programming. (Since Windows already does file encryption, I doubt it would be worth the effort.)

Resources