BinaryKits / BinaryKits.Zpl

BinaryKits.Zpl a set of .net libraries. The project supports you in the simple creation of zebra labels. It generates the ZPL data, it is a printer description language from Zebra Technologies. ZPL II is now emulated by many label printers from different manufacturers. So with this implementation you can create labels for most printers.
MIT License
291 stars 105 forks source link

Fix PDF scaling #251

Open Joshmul1 opened 3 weeks ago

Joshmul1 commented 3 weeks ago

Fixes #250

Joshmul1 commented 3 weeks ago

Good point, I'm not sure why I went down the rabbit hole of using an int specifically. I've updated the PR to handle it as a float and I've tested random inch values and it seems to be good

primo-ppcg commented 2 weeks ago

The scaling doesn't appear to be correct in all cases. Examples 5, 6, and 8 in the WebViewer are all cropped - this is not the case with the current release.

Joshmul1 commented 2 weeks ago

It works for lots of different sizes but then some render with whitespace on the right as the canvas we're drawing on is too small. This is all new territory for me so I can have a mess around with it to try figure out what is going on.

Do you have any initial ideas on what could be causing it to be strange on some sizes?

Joshmul1 commented 2 weeks ago

I've misunderstood the issue you reported earlier. When I use the web api, labeleray and my branch I get the same results on them all.

Can you please give me more info on the issue you're seeing so I can try replicate it?

primo-ppcg commented 2 weeks ago

Can you please give me more info on the issue you're seeing so I can try replicate it?

This is the result of the PDF output for Example 5 with your patch applied (as viewed with Acrobat Reader): example5

Joshmul1 commented 2 weeks ago

Done some more playing around with that particular example and I'm struggling to know what I'm needing to do to debug or fix the issue. I might need some help on this one.

The fix I made does work for a large amount of labels so I can use it for my purposes without issue until someone else can give insight or a solution on the issue.

primo-ppcg commented 2 weeks ago

From what it seems, not all elements are being scaled equally. From the example 5, the graphics boxes appear to be scales, but the text and barcodes are not.

danzk commented 2 weeks ago

From what it seems, not all elements are being scaled equally. From the example 5, the graphics boxes appear to be scales, but the text and barcodes are not.

I believe all the elements should scale after merging my most recent PR. I observed the same issue when trying to scale a canvas passed into the ZplElementDrawer. It is because text and barcodes element drawer clear any scaling applied with the following code.

//Clears the existing rotation or scale applied to the canvas. 
if (matrix != SKMatrix.Empty)
{
    this._skCanvas.SetMatrix(matrix);
}