Giter Site home page Giter Site logo

Comments (8)

flytkgl avatar flytkgl commented on August 19, 2024

我代码只是把图片做了等份分割,没有调整图片大小啊

from pdfqfz.

hyh19962008 avatar hyh19962008 commented on August 19, 2024

你试试用不同的文件测试一下,反正我换了几张图片和PDF都会这样

from pdfqfz.

mimicao avatar mimicao commented on August 19, 2024

原因应该是图片是使用的像素大小,而PdfReader()读取是以72dpi来读取pdf文档的像素。通过实际需要的图片大小(毫米/厘米),再通过72dpi计算出需要插入图片的像素在重新编辑图片像素,应该就解决了。

from pdfqfz.

mimicao avatar mimicao commented on August 19, 2024

以4cm公章为例,其72dpi下的pixel为113,可以使用清晰的图片,重新缩放图片比例大小。
//水印的位置
image.ScaleToFit(113f/numberOfPages, 113f);
image.SetAbsolutePosition(width-113f/numberOfPages, (height - 113f) / 2);

不确定是否有更好的方法来进行处理。

from pdfqfz.

btwise avatar btwise commented on August 19, 2024

以4cm公章为例,72dpi下的像素为113,可以使用清晰的图片,放大其缩放图片比例大小。
//水印的位置
image.ScaleToFit(113f/numberOfPages, 113f);
image.SetAbsolutePosition(width-113f/numberOfPages, (height - 113f) / 2);

是否有更好的方法来进行处理。

能否完善一下整体代码,目前确实无法实现盖章

from pdfqfz.

flytkgl avatar flytkgl commented on August 19, 2024

以4cm公章为例,72dpi下的像素为113,可以使用清晰的图片,放大其缩放图片比例大小。
//水印的位置
image.ScaleToFit(113f/numberOfPages, 113f);
image.SetAbsolutePosition(width-113f/numberOfPages, (height - 113f) / 2);
是否有更好的方法来进行处理。

能否完善一下整体代码,目前确实无法实现盖章

这个工具还有人在用吗......当时我们采购的同事有需求顺手帮忙写的,后面辞职了同事也没跟我反馈过问题就没有再关注了

from pdfqfz.

flytkgl avatar flytkgl commented on August 19, 2024

以4cm公章为例,其72dpi下的pixel为113,可以使用清晰的图片,重新缩放图片比例大小。
//水印的位置
image.ScaleToFit(113f/numberOfPages, 113f);
image.SetAbsolutePosition(width-113f/numberOfPages, (height - 113f) / 2);

不确定是否有更好的方法来进行处理。

普通图片的dpi一般是72,而打印一般需要300dpi,所以我现在是做了个24%的缩放,看起来应该是差不多

from pdfqfz.

flytkgl avatar flytkgl commented on August 19, 2024

以4cm公章为例,72dpi下的像素为113,可以使用清晰的图片,放大其缩放图片比例大小。
//水印的位置
image.ScaleToFit(113f/numberOfPages, 113f);
image.SetAbsolutePosition(width-113f/numberOfPages, (height - 113f) / 2);
是否有更好的方法来进行处理。

能否完善一下整体代码,目前确实无法实现盖章

已修复,随便解决了其他几个小问题

from pdfqfz.

Related Issues (20)

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.