Bug 157362 - Impress: inconsistent PDF export when done from a script invoking LibO in --headless mode
Summary: Impress: inconsistent PDF export when done from a script invoking LibO in --h...
Status: RESOLVED DUPLICATE of bug 118299
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Impress (show other bugs)
Version:
(earliest affected)
7.6.1.2 release
Hardware: x86-64 (AMD64) Linux (All)
: medium normal
Assignee: Not Assigned
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2023-09-21 11:17 UTC by Callegar
Modified: 2023-10-06 13:01 UTC (History)
1 user (show)

See Also:
Crash report or crash signature:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Callegar 2023-09-21 11:17:08 UTC
Description:
Reopening some slides made with LibO 7.5 I am discovering that cropping of the images in 7.6 is slightly different.

Most serious issue is that if I crop the images so that they look nice when editing the slides, as I export the slides to PDF, I get a different cropping in the PDF. Namely, using cropping the exported slides are not a faithful reproduction of what had been prepared.

Steps to Reproduce:
See description

Actual Results:
Different image cropping in slide editing and exported slides

Expected Results:
Exported slides should be consistent with what is being edited


Reproducible: Always


User Profile Reset: No

Additional Info:
[Information automatically included from LibreOffice]
Locale: en-US
Module: PresentationDocument
[Information guessed from browser]
OS: Linux (All)
OS is 64bit: yes
Comment 1 Callegar 2023-09-21 12:19:55 UTC
Interesting enough, the inconsistency in cropping between the document in editing/presenting mode and the PDF export seems to occur only when I do the export programmatically, with a macro.

The core of the macro is the following, I don't see anything strange in it.

```
Dim oPropPDF(3) As New com.sun.star.beans.PropertyValue
oPropPDF(0).Name="ExportNotesPages"
oPropPDF(0).Value=true
oPropPDF(1).Name="ExportBookmarks"
oPropPDF(1).Value=false
oPropPDF(2).Name="EmbedStandardFonts"
oPropPDF(2).Value=true

Dim oProp(3) As New com.sun.star.beans.PropertyValue
oProp(0).Name="Overwrite"
oProp(0).Value=true
oProp(1).Name="FilterName"
oProp(1).Value="impress_pdf_Export"
oProp(2).Name="FilterData"
oProp(2).Value=oPropPDF()

oDoc.storeToURL(pdfURL,oProp())
```

Any clue?
Comment 2 Callegar 2023-09-21 12:21:01 UTC
As an additional detail, I use this macro invoking libreoffice in headless mode.
Comment 3 Callegar 2023-09-21 12:27:25 UTC
And that's it... dropping `--headless` removes the inconsistency in the PDF export... Now, why is it so?
Comment 4 Callegar 2023-09-21 12:34:26 UTC
Maybe something like Bug 118299 biting here too?
Comment 5 Buovjaga 2023-10-03 15:44:53 UTC
Please give full steps with full macro, so we can test.

Set to NEEDINFO.
Change back to UNCONFIRMED after you have provided the information.
Comment 6 Callegar 2023-10-04 21:29:21 UTC
I have been using the following macro for a long time:

REM  *****  BASIC  *****

Sub SaveSlidesAsPDF(srcFile)

srcURL = ConvertToURL( srcFile )

dim oPropDoc(0) as New com.sun.star.beans.PropertyValue
oPropDoc(0).Name="Hidden"
oPropDoc(0).Value=True

'msgbox(srcURL)

oDoc = StarDesktop.loadComponentFromURL( srcURL, "_blank", 0, _
  oPropDoc())
            
pdfFile=Left(srcFile,Len(srcFile)-4)+".pdf"
pdfURL=ConvertToURL( pdfFile )

Dim oPropPDF(3) As New com.sun.star.beans.PropertyValue
oPropPDF(0).Name="ExportNotesPages"
oPropPDF(0).Value=true
oPropPDF(1).Name="ExportBookmarks"
oPropPDF(1).Value=false
oPropPDF(2).Name="EmbedStandardFonts"
oPropPDF(2).Value=true

Dim oProp(3) As New com.sun.star.beans.PropertyValue
oProp(0).Name="Overwrite"
oProp(0).Value=true
oProp(1).Name="FilterName"
oProp(1).Value="impress_pdf_Export"
oProp(2).Name="FilterData"
oProp(2).Value=oPropPDF()

oDoc.storeToURL(pdfURL,oProp())

oDoc.close( True )

End Sub

Sub Shutdown()
oDoc=ThisComponent
oDoc.close(True)
StarDesktop.terminate()
End Sub

It gets invoked from a bash script as

  ${SOFFICE} ${SOFFICE_OPTIONS} \
             "$CMDPREFIX.SaveSlidesAsPDF($fullname)"

Where ${SOFFICE} is libreoffice, ${SOFFICE_OPTIONS} is either --headless or --invisible, ${fullname} is the name of the file to export to PDF.
Comment 7 Callegar 2023-10-04 21:30:26 UTC
In any case I tend to believe that what I am hitting here is Bug 118299, or at least that that issue needs to be fixed first.
Comment 8 Callegar 2023-10-04 21:33:01 UTC
In fact, my hypothesis is that:

- when you ask LibO to be --invisible, it considers your actual screen features;
- when you ask it to be --headless, it uses some default features.

Among these features there is some DPI info that (incorrectly) gets used to determine how the images should be cropped.
Comment 9 Buovjaga 2023-10-06 13:01:17 UTC
Ok, I will close as dupe and add a comment to the other one

*** This bug has been marked as a duplicate of bug 118299 ***