Thanks for the fast reply!
So.. I tried to follow the example and looked at the specification pdf to look for the right action.
Seems like there is a zoom property
zoom=scale
zoom=scale,left,top
Sets the zoom and scroll factors, using float or integer values.
For example, a scale value of 100 indicates a zoom value of 100%.
Scroll values left and top are in a coordinate system where 0,0 represents the top left corner of the visible page, regardless of document rotation.
But when i try to use it i just get an unknown destination type error the same happens when i try the example below
Here is the code:
PdfDocument pdf = new PdfDocument();
PdfPage page = pdf.AddPage();
PdfDictionary dict = new PdfDictionary(pdf);
dict.Elements["/S"] = new PdfName("/GoTo");
PdfArray array = new PdfArray(pdf);
dict.Elements["/D"] = array;
PdfReference iref = PdfInternals.GetReference(pdf.Pages[0]);
array.Elements.Add(iref);
array.Elements.Add(new PdfName("/XYZ 0 0 100"));
pdf.Internals.AddObject(dict);
pdf.Internals.Catalog.Elements["/OpenAction"] = PdfInternals.GetReference(dict);
pdf.Save(path + pdf_name + ".pdf");
Based on this thread:
viewtopic.php?f=2&t=1586&hilit=zoom+levelAny ideas?
Edit:
When i try this approach the pdf changes the zoom, only it changes it to 6400% instead of the 100% i want it to be..
array.Elements.Add(new PdfName("/XYZ"));
array.Elements.Add(new PdfInteger(0));
array.Elements.Add(new PdfInteger(0));
array.Elements.Add(new PdfInteger(100));
Solved:
So zoom here is not the zoom level in percent but the zoom factor, changing from 100 to 1 did the trick
PdfDictionary dict = new PdfDictionary(pdf);
dict.Elements["/S"] = new PdfName("/GoTo");
PdfArray array = new PdfArray(pdf);
dict.Elements["/D"] = array;
PdfReference iref = PdfInternals.GetReference(pdf.Pages[0]);
array.Elements.Add(iref);
array.Elements.Add(new PdfName("/XYZ"));
array.Elements.Add(new PdfInteger(0));
array.Elements.Add(new PdfInteger(0));
array.Elements.Add(new PdfInteger(1));
pdf.Internals.AddObject(dict);
pdf.Internals.Catalog.Elements["/OpenAction"] = PdfInternals.GetReference(dict);