Hello,
After creating a PDF file using the PDFDocument library from inside our application, we display the file using Adobe Acrobat.
The command we are using is:
"C:\Program Files\Adobe\Acrobat DC\Acrobat\Acrobat.exe" "B:\190313_test-3d-lib-test-pth-comps\pantheon\BOARD.pdf"
We have mirrored text in the design, but the text is missing or misplaced in Adobe.
Using a 3rd party application called BullZip PDF the mirrored text is correct.
I've attached the PDF file for each. Can you tell me what the problem is?
Thanks.
Mirrored text not displayed using Adobe Acrobat
Re: Mirrored text not displayed using Adobe Acrobat
One question is whether the text is really missing in the generated PDF or just not displayed due to possibly wrong use of PDF operators.
However, the sample PDFs you provided are too complex to analyze manually. Can you create a minimal sample showing the wrong behaviour and provide its source code? This would allow to further investigate the issue.
Sorry, without seeing the code that generated the graphics/PDF output it is impossible to tell what's going wrong.
From the PDF file I see you used wxPdfDC to create it. Do you display the graphics on screen, too, with the same wxDC code? If yes, does it work as expected?
If possible provide some code that can be used to reproduce the problem.
Re: Mirrored text not displayed using Adobe Acrobat
Hello,
Attached is a much smaller drawing with one mirrored text string and one non-mirrored text string.
The smaller text is reference text and is not mirrored. The mirrored text is on the bottom of the board.
The drawing on the screen (first drawing) is correct. The second drawing is displayed in Adobe generated using PDFLibrary.
The third drawing is displayed in Adobe and is generated from Bullzip PDF.
All drawings were generated using the same code. Below is a snippet of the relevant code used to display.
Attached is a much smaller drawing with one mirrored text string and one non-mirrored text string.
The smaller text is reference text and is not mirrored. The mirrored text is on the bottom of the board.
The drawing on the screen (first drawing) is correct. The second drawing is displayed in Adobe generated using PDFLibrary.
The third drawing is displayed in Adobe and is generated from Bullzip PDF.
All drawings were generated using the same code. Below is a snippet of the relevant code used to display.
Code: Select all
wxPoint point = true_type_text__determine_display_origin_from_extent(text_p, text_value, displayFont, *dc, display_conversion_p) ;
if( graphics__mirror_transform(window_attribute_p, text_p) )
{
wxAffineMatrix2D mat = dc->GetTransformMatrix() ;
mat.Translate(point.x, point.y);
if( graphics__get_board_view_side() != text__get_board_side(text_p) )
{
if( import_export.window_p->edit_p->edit_attribute_p->display_status & object_$flip_vertical )
mat.Mirror(wxVERTICAL|wxHORIZONTAL);
else
mat.Mirror(wxHORIZONTAL);
}
else if( import_export.window_p->edit_p->edit_attribute_p->display_status & object_$flip_vertical )
{
mat.Mirror(wxVERTICAL);
}
dc->SetTransformMatrix(mat);
if( double__equal(orientation, 0.0) )
dc->DrawText(string_display_value, 0, 0) ;
else
dc->DrawRotatedText(string_display_value, 0, 0, orientation) ;
dc->ResetTransformMatrix();
}
else
{
if( text_p->right_reading )
{
if( graphics__get_board_view_side() != text__get_board_side(text_p) )
{
if( !(import_export.window_p->edit_p->edit_attribute_p->display_status & object_$flip_vertical) )
{
if( !true_type_text__check_orthogonal(orientation) )
orientation = orientation__set_positive(-orientation) ;
}
}
else if( import_export.window_p->edit_p->edit_attribute_p->display_status & object_$flip_vertical )
{
if( !true_type_text__check_orthogonal(orientation) )
orientation = orientation__set_positive(-orientation) ;
}
}
if( double__equal(orientation, 0.0) )
dc->DrawText(string_display_value, point.x, point.y) ;
else
dc->DrawRotatedText(string_display_value, point.x, point.y, orientation) ;
}
Re: Mirrored text not displayed using Adobe Acrobat
Thanks for the smaller sample and the code snippet.
In the screenshot of the sample generated with wxPdfDocument resp wxPdfDC I see that the mirrored text is slightly displaced to the left. This could indicate that something went wrong on applying the transformation matrix.rsb wrote: ↑Wed Jun 07, 2023 3:48 pm The drawing on the screen (first drawing) is correct. The second drawing is displayed in Adobe generated using PDFLibrary.
The third drawing is displayed in Adobe and is generated from Bullzip PDF.
All drawings were generated using the same code. Below is a snippet of the relevant code used to display.
I will try to find out whether there is something wrong with the handling of transformations.
Re: Mirrored text not displayed using Adobe Acrobat
Using wxPdfDC's default settings the transformations seem to work as expected. However, it is still possible that there is a bug when using non-default settings.
So, could you please let me know the settings you are using, namely whether you modify the resolution (wxPdfDC::SetResolution()), the mapping mode (wxDC::SetMapMode()) and/or the mapping mode style (wxPdfDC::SetMapModeStyle()) and/or the user scale (wxDC::SetUserScale()).
So, could you please let me know the settings you are using, namely whether you modify the resolution (wxPdfDC::SetResolution()), the mapping mode (wxDC::SetMapMode()) and/or the mapping mode style (wxPdfDC::SetMapModeStyle()) and/or the user scale (wxDC::SetUserScale()).
Re: Mirrored text not displayed using Adobe Acrobat
We're not using any of the above settings.
Re: Mirrored text not displayed using Adobe Acrobat
Well, I'm at a loss. As said, I made several experiments using default settings and it works as expected. The only idea I have is that maybe something goes wrong on calculating the transformation point based on the text extent. For example, if the text extent is calculated with a different font than is actually used by wxPdfDC to draw the text that could result in shifted text placement.
Re: Mirrored text not displayed using Adobe Acrobat
Can I ask what application you use to display the PDF document and how do you invoke the application?
Are you invoking like we do (below) or some other method?
"C:\Program Files\Adobe\Acrobat DC\Acrobat\Acrobat.exe" "B:\190313_test-3d-lib-test-pth-comps\pantheon\BOARD.pdf"
Thanks.
Are you invoking like we do (below) or some other method?
"C:\Program Files\Adobe\Acrobat DC\Acrobat\Acrobat.exe" "B:\190313_test-3d-lib-test-pth-comps\pantheon\BOARD.pdf"
Thanks.
Re: Mirrored text not displayed using Adobe Acrobat
I query the wxFileType class for the open command. Essentially, this results in invoking the default PDF viewer (Acrobat Reader on my Windows system).
Yes, the open command looks similar. I doubt that the problem has anything to do with the PDF viewer.
AFAICT something goes wrong with the transformation matrix. And the most likely cause is that the translation point that is based on the text extent is not calculated correctly - resulting in misplacing the text output. My guess is that the calculation of the text extent uses a different font than that that is actually used for PDF output in wxPdfDC. However, without having access to the source code I'm not able to further debug the issue.