Click here to Skip to main content
15,888,351 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi All,

I've written a program to generate an report with qr code.
Now if i use the code ive written, im able to generate it, but all of the qr codes
are generating on the same page. What I'm looking for is to generate qr code on the
same bookmark area but in a new page, with a new qr code
for example
page 1 = qr1
page 2 = qr2

Can anyone help or point me, i'm trying google but can't find what im looking for.
Below is my code

What I have tried:

    for (int i = 0; i < int.Parse(totalpallet.Text); i++)
                {
                    var shape = aDoc.Bookmarks["qrprod"].Range.InlineShapes.AddPicture(@"C:\QRSTORE\Production\" + productionorder.Text + "_" + sap.Text + i + ".jpg", false, true);
                    shape.Width = 45;
                    shape.Height = 45;

                    var shape1 = aDoc.Bookmarks["qrfgmms"].Range.InlineShapes.AddPicture(@"C:\QRSTORE\FG-MMS\" + productionorder.Text + "_" + sap.Text + i + ".jpg", false, true);
                    shape1.Width = 45;
                    shape1.Height = 45;
}
Posted
Updated 18-Feb-19 8:14am

If you want to insert qr code on next page, use have to add page brake, see: Range.InsertBreak Method (Microsoft.Office.Interop.Word) | Microsoft Docs[^]


Note: you have to do it twice: fisrt time when add first qr code and second time when you add another qr code. All inside a for ... next loop.
 
Share this answer
 
Advice:
Generating QR codes as jpg pictures is a bad idea.
jpeg is a lousy picture format, the picture loose information as the compression is done.
The problem is that some pixels that were black or white are changing of color, this make the QR code more difficult to read.
Second problem, the QR code is resized when printed, it makes quality even worse.
The options are:
jpg/jpeg: bitmap with lousy compression, probably worst choice.
png/gif: bitmap with lossless compression, a better choice.
svg: vector-based graphics, keep top quality when resized.
Scalable Vector Graphics - Wikipedia[^]
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900