ajaxray/markpdf

Image not working for some files

thanhtoan1196 opened this issue · 8 comments

Image not working for some files
Example: example.pdf

Hello @thanhtoan1196 ,

Thanks for asking 👍🏼
But the information you've shared is too few to investigate the issue.

Can you please check and confirm the following thing:

  • The OS you're operating on
  • The image filename
  • Check if the image path is correct according to the command execution path
  • If any error/warning was displayed after command execution (share screenshot if any)
  • If you were able to use it successfully with other image and PDF

Hope we'll be able to resolve it together :)

Hello @ajaxray ,
Additional information:

  • The OS you're operating on: Debian GNU/Linux 10 (buster)
  • The image filename: watermark.png
  • The image path is correct
  • No error/warning, command executed successfully but the resulting file only has 1 page and blank content
  • I tried the image file with another pdf file, it works fine, only this pdf file does not work, I think it's because the file structure is something different

Please check, thanks.

@thanhtoan1196,
Can you please share the full command you've used?

@ajaxray ,
this is the command:

markpdf "/tmp/down-net_http20210701-137-bb60fl" watermark.png "/tmp/2415704.pdf" --center --opacity=0.1 --angle=45

@thanhtoan1196 ,
The command seems OK.
Please try running the command with adding -v flag and share if any error is printed.

ok I will try

@ajaxray
here is the error log

root@ae7f504c61a8:/Users/u12/Desktop/backend# ./markpdf example.pdf watermark.png 1572.pdf --center --opacity=0.1 --angle=45 -v
2021/07/18 15:54:29 Input PDF: example.pdf
2021/07/18 15:54:29 Watermark Image: watermark.png
[DEBUG]  parser.go:1530 Pdf version 1.4
[DEBUG]  main.go:104 Failed to get page mediabox: Media box not defined
2021/07/18 15:54:29 Page Width       : 0
2021/07/18 15:54:29 Page Height      : 0
2021/07/18 15:54:29 Watermark Width  : 345
2021/07/18 15:54:29 Watermark Height : 35
[DEBUG]  main.go:104 Failed to get page mediabox: Media box not defined
[DEBUG]  main.go:104 Failed to get page mediabox: Media box not defined
[DEBUG]  main.go:104 Failed to get page mediabox: Media box not defined
[DEBUG]  main.go:104 Failed to get page mediabox: Media box not defined
[DEBUG]  main.go:104 Failed to get page mediabox: Media box not defined
[DEBUG]  main.go:104 Failed to get page mediabox: Media box not defined
[DEBUG]  main.go:104 Failed to get page mediabox: Media box not defined
SUCCESS: Output generated at : 1572.pdf 

same issue with me. For few of my PDFs it is giving it as it is without adding watermark

2024/05/05 06:55:23 Input PDF: F:\ku_n\626.pdf
2024/05/05 06:55:23 Watermark Image: water.png
[DEBUG]  parser.go:1530 Pdf version 1.6
2024/05/05 06:55:23 Page Width       : 595.275591
2024/05/05 06:55:23 Page Height      : 841.889764
2024/05/05 06:55:23 Watermark Width  : 595
2024/05/05 06:55:23 Watermark Height : 842```