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

Width text height #281

Open
lublak opened this issue Jan 26, 2023 · 8 comments
Open

Width text height #281

lublak opened this issue Jan 26, 2023 · 8 comments

Comments

@lublak
Copy link

lublak commented Jan 26, 2023

Hi, ich found your lib :) and its awesome. If i understand correctly i can set the maxheight and width with widht and height and it generates the biggest barcode possible in this size. This is awesome!
But I have some issues with text. It looks very strechy.
Can i somehow make the text auto resize in the height? So it looks more normal?

grafik

I try to create a barcode with max 200mm width and max 100mm height and render it to a pdf.

@metafloor
Copy link
Owner

To generate a barcode without text stretching, set the scale to achieve the desired width. Then adjust the height, For your example, you could start with scale=3 and height=15.

@lublak
Copy link
Author

lublak commented Jan 26, 2023

@metafloor so to get a perfect barcode i need to generate it twice?
First to get the default width and hight of the image. As an example 50mm.
If i need a 200 width barcode i device it with 50mm (200/50=4)
so i get a scale of 4 and i need to generate it again? Or is it possible to get the size without generate it?

@lublak
Copy link
Author

lublak commented Jan 28, 2023

So for the complete ratio:
ratio = Math.min(maxWidth / srcWidth, maxHeight / srcHeight)

I have a simple place in the pdf and here should be the barcode with the maximum size in the available space.

I found the method raw which gets some data. But can I pass the raw to the render function?

@metafloor
Copy link
Owner

Are you only generating ISBN barcodes? Because they are fixed format. Or are you looking for a generic solution for different barcode types?

@lublak
Copy link
Author

lublak commented Jan 31, 2023

@metafloor I will not only use ISBNs but all sorts of things. Therefore, I am already looking for a general solution that works for all barcodes.
There is always a fixed coordinate and width and height.

@lublak
Copy link
Author

lublak commented Feb 12, 2023

@metafloor i think there is only the double generation for this or?
So it can be closed?

@metafloor
Copy link
Owner

Sorry, lost track of this issue. Yes, you will need to double generate. It is the same as with using BWIPP in a postscript environment.

@lublak
Copy link
Author

lublak commented Feb 12, 2023

Sorry, lost track of this issue. Yes, you will need to double generate. It is the same as with using BWIPP in a postscript environment.

@metafloor no problem :) thanks for the answer
I can use raw so it doesn't generate to much data.
And run it again to generate the pdf image.

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