Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Problem with PDF printing #10

Open
3lf opened this issue Apr 6, 2022 · 2 comments
Open

Problem with PDF printing #10

3lf opened this issue Apr 6, 2022 · 2 comments

Comments

@3lf
Copy link

3lf commented Apr 6, 2022

Hi,
thanks for good library.
i have issue with print pdf.
when i print pdf, it prints source.
for example:
%PDF-1.4 %���� 1 0 obj <</Creator (Mozilla/5.0 \(X11; Linux x86_64\) AppleWebKit/537.36 \(KHTML, like Gecko\) Chrome/99.0.4844.82 Safari/537.36) /Producer (Skia/PDF m99) /CreationDate (D:20220406213418+00'00') /ModDate (D:20220406213418+00'00')>> endobj 3 0 obj <</ca 1 /BM /Normal>> endobj 5 0 obj <</Type /XObject /Subtype /Image /Width 1107 /Height 192 /ColorSpace /DeviceGray /BitsPerComponent 8 /Filter /DCTDecode /ColorTransform 0 /Length 4524>> stream ����^@^PJFIF^@^A^A^@^@^A^@^A^@^@��^@C^@^P^K^L^N^L ^P^N^M^N^R^Q^P^S^X(^Z^X^V^V^X1#%^](:3=<9387@H\N@DWE78PmQW_bghg>Mqypdx\egc��^@^K^H^@�^DS^A^A^Q^@��^@^[^@^A^@^B^C^A^A^@^@^@^@^@^@^@^@^@^@^@^A^E^B^> ^T(P�B�

can you help me?

@3lf
Copy link
Author

3lf commented Apr 6, 2022

i used sample code:

package main

import (
	"log"
	"github.com/jadefox10200/goprint"
)

func main() {

	printerName, _ := goprint.GetDefaultPrinterName()

	//open the printer
	printerHandle, err := goprint.GoOpenPrinter(printerName)	
	if err != nil {log.Fatalln("Failed to open printer")}
	defer goprint.GoClosePrinter(printerHandle)
	
	filePath := "C:/test/myPDF.pdf"
		
	//Send to printer:		
	err = goprint.GoPrint(printerHandle, filePath)
	if err != nil {	log.Fatalln("during the func sendToPrinter, there was an error") }


}

@3lf 3lf changed the title issue on print pdf Problem with PDF printing Apr 6, 2022
@jadefox10200
Copy link
Owner

jadefox10200 commented Apr 30, 2022

Looks like it's printing the raw code of the PDF. What printer are you using? This package is VERY basic and sends the data to the printer raw. This means your printer must be able to understand the PDF language.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants