We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
Need to implement SingleImageToPdf transformer for convert single image to the single page pdf.
Please use img2pdf package.
It should have following params:
Please use HasOutputCol, HasInputCol, HasResolution classes. For example:
class SingleImageToPdf(Transformer, DefaultParamsReadable, DefaultParamsWritable, HasOutputCol, HasInputCol, HasResolution):
And should use following code for transform image to pdf:
imageResolution = image.resolution if imageResolution == 0 or imageResolution is None: imageResolution = 300 if self.getResolution() > 0: imageResolution = self.getResolution()
width = image.width / imageResolution * self.POINTS_PER_INCH height = image.height / imageResolution * self.POINTS_PER_INCH
a4inpt = (img2pdf.mm_to_pt(210), img2pdf.mm_to_pt(297)) layout_fun = img2pdf.get_layout_fun(a4inpt) pdf_bytes = img2pdf.convert(io.BytesIO(image.data), layout_fun=layout_fun)
And create good test coverage for Spark and Local pipelines.
The text was updated successfully, but these errors were encountered:
slavkomelnyk
No branches or pull requests
Need to implement SingleImageToPdf transformer for convert single image to the single page pdf.
Please use img2pdf package.
It should have following params:
Please use HasOutputCol, HasInputCol, HasResolution classes. For example:
class SingleImageToPdf(Transformer, DefaultParamsReadable, DefaultParamsWritable, HasOutputCol, HasInputCol, HasResolution):
And should use following code for transform image to pdf:
imageResolution = image.resolution
if imageResolution == 0 or imageResolution is None:
imageResolution = 300
if self.getResolution() > 0:
imageResolution = self.getResolution()
width = image.width / imageResolution * self.POINTS_PER_INCH
height = image.height / imageResolution * self.POINTS_PER_INCH
a4inpt = (img2pdf.mm_to_pt(210), img2pdf.mm_to_pt(297))
layout_fun = img2pdf.get_layout_fun(a4inpt)
pdf_bytes = img2pdf.convert(io.BytesIO(image.data), layout_fun=layout_fun)
And create good test coverage for Spark and Local pipelines.
The text was updated successfully, but these errors were encountered: