Giter Site home page Giter Site logo

stchan / pdfscribe Goto Github PK

View Code? Open in Web Editor NEW
258.0 13.0 81.0 35.92 MB

A PDF virtual printer for 64-bit Windows / .NET 4.8 or later

License: GNU Affero General Public License v3.0

C# 54.60% Rich Text Format 45.00% Batchfile 0.40%
pdf windows printer-driver 64-bit

pdfscribe's People

Contributors

comradekingu avatar stchan avatar zhuangkh avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

pdfscribe's Issues

Expose paper size to select on printer properties

I'm looking for a way to make some custom paper size that user can select on printer properties like another printer does. Is there anyway I can make it true? Thanks for spending time for my question!

Unable to build PdfScribeInstall

When I try to build the solution, I don't understand how to build PdfScribeInstall to get final installer file. After building the PdfScribeInstall\bin\Debug folder is empty, and I get the following message in the Output:
Skipped Build: Project: PdfScribeInstall, Configuration: Debug x64 ------
3>Project not selected to build for this solution configuration

Thanks in advance.

PDF file name automatically

Hello,
I would like to suggest that the printer take by default (when possible) the name of the file or the tittle that you want to print.

Congratulations, great virtual printer and gread job. thanks!

Greetings.

Author's name

Hello.
Is there a way to have my name as "Author's name" within the created pdf file?

File extension does not match file type

Using v1.3.2.30119 installed from MSI. Default configuration.

When printing a Word .docx file thru PdfScribe, even though the "Save as type" is .pdf, the output file name still ends in .docx.

PdfScribe - Save Dialog

This results in an output file of type "pdf" but an extension of "docx". Which fails to open correctly.

PdfScribe - Open Dialog

The expected behavior would be for the output file extension ".pdf" to match the file type "pdf".

Printer Not Run Port When Print

Dear Stchan ,
When i print PDF, it not starting with services Print Spooler, how to we can fix problem this in windows 10, if you have any solution or any suggest for me , please help, thank you.I have try with PDF24 and PDF Creator, it working normal.
Image describe :
If i fix by step use troubleshoot, it worked

image
Port Working
image
With start first computer, it not working and can't seach port to print.

Does C# / .NET slow down printing / PDF creation?

First off, great project. I was looking everywhere for a viable virtual PDF printer.
During my research, I read comments that said using C# / .NET would slow down or use too many resources for printing / PDF creation compared to C++. Is this true for this project?

Option to open PDF after it was created

Thanks for this bloat free nice and simple PDF printer driver. It's exactly what I was looking for. The only thing I miss is an option to automatically open the PDF once it's been written. Would you be able to add this?

side note: the driver is able to print other page sizes than letter (which is stated in your readme here on Github). I at least have no issues with printing documents in the German A4 size correctly.

Not able to Print Secured Pdf but allowed print

image
First of all. great project. using sense 2years. I have one pdf which is password protected and i am able to open it without password but its not working with pdfscribe. and that pdf if allowed to Print but its not working. Please help

Support for 32bit processor

Hi,

I really appreciated for what you have done for this project. That helps me a lot for my currently project. But, now I'm facing a challenge with the 32bit processor because the dll which included in this project is not supported for 32bit.
Is there any way I can change the project to supports 32bit processor?

Huge thanks.

bug with filename containing unicode/utf8 letters

Hello,
Very helpful project. Thanks a lot for developing and sharing it.

Context :

  • Windows 8.1 64bits (french version)
  • PdfScribe v1.0.7 downloaded from your github releases.

I found this bug :

  • When the filename of the printed pdf contains unicode/utf8 letters, the saved filename might ends-up truncated.

How to replicate :

  • Save a printed pdf as : facture_échantillons.pdf

Observed result :

  • The pdf will be saved as : facture_฀

Pages are rotated

Hi,

Thanks for such a helpful project.
I would like to inform about an issue.

Scenario 1: The input PDF file with default page size i.e. A4. The generated output PDF file also contains identical pages i.e. A4.

Scenario 2: The input PDF file with custom page size i.e. epos bill receipt (height-width ratio is quite high). The generated output PDF file contains 90deg anticlockwise rotated pages. However, the inverted height-width ratio is the same as the original. So, the pages are only rotated after generation.

Consideration: During a print, I have ticked the 'Choose paper source by PDF size' option.

Kindly address the said issue.

Thanks

Can we forward the print job to print queue without convert to PDF

Hi,

Really appreciated for what you have provided here with this awesome project. I have a question regarding to the print job in program.cs file. In my project, I need to handle for some case that does not required to convert to PDF. Therefore, the inputted document should directly forward to printer. Is it possible here to do so in this project?

Thank you so much!

Understanding the PdfScribe Project

Hi,
Please walk me through or give brief overview of different projects as part of PdfScribe and how Ghostscript and Redmon in conjunction with PdfScribe works to deliver pdf files.

Custom header and footer

Can there be any custom header and footer to be added to the content being sent to the virtual driver?
Or can we modify the content before printing?
If so, then this would be great feature to be added to this software.

slient installation

dot not want wix install ,just exe file to install pdfscribe sothat we can bulk install 100 PC

Exception in Windows 10

Hi,

I am using your source code from version 1.0.5 this time but I still get an exception on line 172 in Program.cs

using (SaveFileDialog pdfFilenameDialog = new SaveFileDialog())
                        {
                            pdfFilenameDialog.AddExtension = true;
                            pdfFilenameDialog.AutoUpgradeEnabled = true;
                            pdfFilenameDialog.CheckPathExists = true;
                            pdfFilenameDialog.Filter = "pdf files (*.pdf)|*.pdf";
                            pdfFilenameDialog.ShowHelp = false;
                            pdfFilenameDialog.Title = "PDF Scribe - Set output filename";
                            pdfFilenameDialog.ValidateNames = true;
                            if (pdfFilenameDialog.ShowDialog(dialogOwner) == DialogResult.OK)

The stack trace is

Exception Info: System.InvalidOperationException
at System.Windows.Forms.CommonDialog.ShowDialog(System.Windows.Forms.IWin32Window)
at PdfScribe.Program.GetPdfOutputFilename(System.String ByRef)
at PdfScribe.Program.Main(System.String[])

There is no error in the UI but I never receive a prompt to the save dialog to save the pdf. This is with both the installer provided in the release and by building the project myself. In Windows 7 I get the prompt to the save dialog.

How to stay the fonts?

Dear Stchan,
how to stay the fonts when i print a pdf to pdf by pdfscribe?
I really appreciate your answering my question

Get the original file information

Hi, stchan,

The pdfscribe.exe read the console stream to a temp file. Is there any way to get the original file information? like title, etc..

Thanks!

Auto open pdf reader

Hi,

Thanks for all your support, I'm almost completed my app but there are still a minor problem that app always open the pdf reader automatically whenever it's running.
The reason is because of the ghostscript execution. But, is there anyway prevent this from open the pdf reader?

Thanks again!

Exception happens when I'm trying to open generated pdf using iTextSharp library

Hi,
After pdf generation by ghostscript method (GhostScript64.CallAPI(ghostScriptArguments)
I'm trying to open pdf using iTextSharp library to read as text but exception is occurring which is caught under catch (IOException ioEx).

Below is my sample code snippet

GhostScript64.CallAPI(ghostScriptArguments);
DisplayPdf(outputFilename);
String pdfContent = ReadPDF(outputFilename);
...

static String ReadPDF(String outputFilename)
{
    StringBuilder text = new StringBuilder();
     
    using (PdfReader reader = new PdfReader(outputFilename))
    {
        for (int i = 1; i <= reader.NumberOfPages; i++)
        {
            text.Append(PdfTextExtractor.GetTextFromPage(reader, i));
        }
        reader.Close();
    }
    return text.ToString();
}

Orginal file name with PDF extension

Hi Sherman,
First of all thank you for the great project.
Just I want to know that is it prossible to get orginal file name with pdf extension?
for example: Book1.xlsx to Book1.PDF
Regards

Couldn't use environment variable in output filename

The PdfScribe.exe.config is that:

<?xml version="1.0"?>
<configuration>
  <configSections>
    <sectionGroup name="applicationSettings" type="System.Configuration.ApplicationSettingsGroup, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" >
      <section name="PdfScribe.Properties.Settings" type="System.Configuration.ClientSettingsSection, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" />
    </sectionGroup>
  </configSections>
  <startup>
    <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.0"/>
  </startup>
  <system.diagnostics>
    <trace autoflush="true" />
    <sources>
      <source name="PdfScribe"
               switchName="PdfScribeAll" >
        <listeners>
          <add name="textwriterListener"
              type="System.Diagnostics.TextWriterTraceListener"
              initializeData="PdfScribe_trace.log"
              traceOutputOptions="DateTime" />
          <remove name="Default" />
          <clear /> <!-- Remove the <clear /> element to turn on tracing output -->
        </listeners>
      </source>
    </sources>
    <switches>
      <add name="PdfScribeAll" value="Verbose"/>
    </switches>
  </system.diagnostics>
  <applicationSettings>
    <PdfScribe.Properties.Settings>
        <setting name="OutputFile" serializeAs="String">
            <value>C:\Temp\TEMP_%RAND%.PDF</value>
        </setting>
        <setting name="AskUserForOutputFilename" serializeAs="String">
            <value>False</value>
        </setting>
        <setting name="OpenAfterCreating" serializeAs="String">
            <value>True</value>
        </setting>
    </PdfScribe.Properties.Settings>
  </applicationSettings>
</configuration>

The environment variable RAND is my custom system environment variable. It does not contain any illegal characters, but PdfScribe couldn't save the PDF and threw out an error called -100.

Choosing custom paper size

                `String[] ghostScriptArguments = 
                {
                    "-dBATCH",
                    "-dNOPAUSE",
                    "-dSAFER",
                    "-sDEVICE=pdfwrite",
                    String.Format("-sOutputFile={0}", outputFilename),
                    standardInputFilename,
                    "-c",
                    @"[/Creator(PdfScribe 1.0.7 (PSCRIPT5)) /DOCINFO pdfmark",
                    "-f"
                };`

As I understand the ability to set custom papersize is to use ghostscript arguments -dDEVICEWIDTHPOINTS=w -dDEVICEHEIGHTPOINTS=h in that piece of code?

Some compatibility errors

Dear Stchan,
I printed a PDF in Windows7. The printed document has an error as shown in the figure below, which seems to be a postscript compatibility problem. Can you tell me how to solve this problem.THX.

error

Thanks for your work!

Hi Sherman,

I would like to thank you for your pdf scribe printer; I use it for my own project https://github.com/cedrozor/myrtille with great success! :)

I needed a PDF virtual printer for Myrtille and didn't wanted to rely on PDFCreator (I used it long time ago, but it now comes with some adware) or any commercial printer.

Yours is simple, with nice exception handling and efficient :)

Regards,
Cedric

Custom Windows UI form doesn't show up

I created a custom windows form and triggered it using Application.Run(CustomForm()) and form.ShowDialog() and form.Show() from Program.cs in PdfScribe.
When printing a document the form is not showing, but the process keeps running in the background.

However, when I tried double clicking the exe, the form showed up. It doesn't show up only when I try to print from some other application.

Opening Custom Windows Form

I created a custom windows form and triggered it using Application.Run(CustomForm()); from Program.cs in PdfScribe.
When printing a document the form is not showing, but the process keeps running in the background. Any hints why the form not showing up ?

Ghostscript Error 100

picturemessage_moaloifw pus
This is an error occurring when I am trying to print from adobe reader. This error only occurs when I am trying to print some specific document(I can't upload that document). Please help

Thank you

build failed wix 3.14 vs 2022

严重性 代码 说明 项目 文件 行 禁止显示状态
错误 命令“powershell -command "del ((Split-Path 'E:\PdfScribe-master\PdfScribeInstall\bin\x64\Release\en-us\PdfScribeInstall_1.3.2.31825.msi' -parent) + '*.sha512')"”已退出,代码为 1。 PdfScribeInstall C:\Program Files (x86)\MSBuild\Microsoft\WiX\v3.x\wix.targets 781

windows 10 no pdf generated.

Hi,

I was wondering if pdfscribe driver has been tested with windows 10? The driver works fine in Windows 7 but on Windows 10, the pdf output file is not generated. When I look in the event viewer there is an entry:

Fault bucket , type 0
Event Name: CLR20r3
Response: Not available
Cab Id: 0

Problem signature:
P1: PdfScribe.exe
P2: 1.0.6621.5424
P3: 5a868fb0
P4: System.Windows.Forms
P5: 4.7.3221.0
P6: 5b885a5a
P7: ad6
P8: 20
P9: System.InvalidOperationException
P10:

AddPrinterDriver caused an win32 error with code 216

Hi @stchan, thank you for all your idea and hard work on this project. This was helped me to build my own printer. I'm not quite familiar on windows driver code. Therefore, this project costs me a lot of efforts.
Due to unsupported of Wix to build 2 platforms support msi package, then I decided to create 1 package for each platform. The one for 64-bits processor worked perfectly, but for the 32-bits one. I'm facing an win32 error with the code 216. But, with the same 32-bit package, I was able to installed on another computer of my friend.

win32 - error code 216: The image file %1 is valid, but is for a machine type other than the current machine. ERROR_EXE_MACHINE_TYPE_MISMATCH

Then I create a program (not an installer) try to create PrinterDriver only with the same function you already provided (level 6 with DRIVER_INFO_6) by calling AddPrinterDriver from winspool.drv. Unfortunately, the error's still happening.
I have searched for 3 days but it seems no clue for me to resolve this issue. Please give me a help.

Thank you so much!

Running as system user

Redmon redirecting to .exe as 'System' user. and it's running in the background. Exe is running is background so not working

No Output on Windows 10 1809

This program used to work perfectly. After the Windows 10 1809 update (specifically, on 17763.529) PDF Scribe fails to generate any output. If you run the EXE directly from the Program Files directly, a blank PDF file is correctly generated. I first noticed the issue with a custom fork but it appears to affect the master branch of 1.0.7 as well.

Print fails with "The system cannot find the file specified" error if I change namespaces and output filenames in projects, compile and install

I changed the project namespaces and output filenames. Printing fails with "The system cannot find the file specified" error (logged in Microsoft/Windows/PrintService/Admin in event log). Original solution works fine. Am I supposed to keep namespaces and/or output files names as is or is there a setting somewhere that I need to change to adapt namespace and output filename changes?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.