When I print it in PDF directly in word, this doesn’t happen. Is there a workaround for this? Currently the only code I have is for convertion. This is the code where document is saved as pdf:
Because of that less content can be fit in the first column and the second column is broken because of the explicit column break.
You may notice the same result in Microsoft Word if you reset the scaling to 100%.
Anyway, note that we do have an internal support ticket for this and I’ve added your report to it as well in order to increase its priority.
But at this moment I cannot tell you exactly when it will be implemented.
We prioritize feature request implementations by the number of users requesting it and currently, we are working on some other feature which has a greater priority (more user requests).
Regarding the workaround for the scaling, can you try using this:
var document = DocumentModel.Load("Minnesota-HIPAA-Auth-Form.docx");
foreach (Run run in document.GetChildElements(true, ElementType.Run))
{
var format = run.CharacterFormat;
double ratio = format.Scaling / 100.0;
format.Size *= ratio;
}
document.Save("Minnesota-HIPAA-Auth-Form.pdf");
Regarding the missing shapes, the problem is that those are shapes with custom geometry.
Can you change those into rectangle shapes?
Nevertheless, note that we’re currently working on adding support for rendering shapes with custom geometry. So, can you please try again with this latest bugfix version:
It is rendering shapes w/custom geometry now (thanks for the hotfix), and still I can see sometimes a shape merges with some offset from its position in the template even if it is in line with text.
The thing is templates are being created by export tools from pdf to docx and users just place merge fields using text boxes wherever they need to. I wonder if you can suggest what exporting tool would output a docx that works with gembox the best
Sometimes the original document is not a pdf but an rtf. Either it is PDF or RTF, file is converted to docx to use it as a template
I notice that gembox.document replaces column breaks with a new line that pushes content down and sometimes a new page is necessary for only one line of text.
The problem is that the position of the floating and inline shape may depend on the previous or surrounding content. So if that content is rendered differently (for instance, due to the used character spacing) the position may end up being slightly different.
Have you tried using GemBox.Document for this:
Also, note that GemBox.Document can convert RTF to DOCX.
What do you mean by that?
Are you perhaps referring to your previous issue in which the column break was moved to the second column and thus it resulted in a page break?
Not exactly. After changing implementing your code to change ratio in text size, there is sometimes a new line inserted and after inspecting, I discovered that column breks are merged as a new line:
Can you try saving the DocumentModel to DOCX to check from where does that new line come from.
Of course, when you make the changes to the Size, set the Scaling to 100 because otherwise, you’ll have both formatting in the output DOCX file.
Can you send us your input PDF file?
Also, can you tell us how that PDF file was generated?