Forum


Replies: 3   Views: 1405
Libreoffice pdf export and native pdf export can not interpret linebreaks created by bulkprocessing
Topic closed:
Please note this is an old forum thread. Information in this post may be out-to-date and/or erroneous.
Every phpdocx version includes new features and improvements. Previously unsupported features may have been added to newer releases, or past issues may have been corrected.
We encourage you to download the current phpdocx version and check the Documentation available.

Posted by michael.stubenvoll  · 27-10-2020 - 10:13

Hi,
I just found a bug, when trying to convert a docx file to a pdf file, which has before added newLines through the replaceText (with option parseLineBreaks) method. In MS Word 2006, the document looks fine. But when I try to save the document as an pdf, the new inserted newLines are ignored.


The problem only appears when using the replaceText method from Bulk Processing.
When I use the replaceVariableByText method from the CreateDoxcFromTemplate Class the exported pdf file looks fine.
I compared both word sources and indeed the resulting source code is different:
Bulk Processing:

<w:t xml:space="preserve">Herr<w:br/>Harry Bittner<w:br/>ImNebelloch 18<w:br/>71034 Böblingen</w:t>

CreateDoxcFromTemplate:

<w:t xml:space="preserve">Herr</w:t><w:br/><w:t xml:space="preserve">Harry Bittner</w:t><w:br/><w:t xml:space="preserve">ImNebelloch 18</w:t><w:br/><w:t xml:space="preserve">71034 B&#xF6;blingen</w:t>

I hope you can help me with a fixed for that.
Greetings
Michael

Posted by admin  · 27-10-2020 - 10:33

Hello,

Please send to contact[at]phpdocx.com the username or e-mail of the user that has purchased the license you are using and if you are using the classic or namespaces package.

Regards.

Posted by admin  · 27-10-2020 - 14:50

Hello,

Thanks for sending the requested information Your e-mail was replied two hours ago by the support team, this is a copy of the answer:

Thanks for sending the requested information. Please edit Classes/Phpdocx/Utilities/BulkProcessing.php and in the method replaceTextContents (around line 898), replace:

$stringDoc = str_replace('__LINEBREAK__', '<w:br />', $dom->saveXML());

by:

$stringDoc = str_replace('__LINEBREAK__', '</w:t><w:br /><w:t xml:space="preserve">', $dom->saveXML());

And try again, this change should fix the issue with LibreOffice and BulkProcessing when parseLineBreaks is enabled. The same change has been applied to the current testing branch.

Regards.

Posted by pp9441185  · 30-10-2020 - 08:41

Deleted by admin · 30-10-2020 - 09:36