View Issue Details
ID | Project | Category | View Status | Date Submitted | Last Update |
---|---|---|---|---|---|
0017198 | Scribus | Import / Export | public | 2024-04-14 02:13 | 2024-09-16 20:54 |
Reporter | dmahoney | Assigned To | jghali | ||
Priority | normal | Severity | minor | Reproducibility | always |
Status | closed | Resolution | fixed | ||
Product Version | 1.6.0 | ||||
Fixed in Version | 1.6.2.svn | ||||
Summary | 0017198: PDF text fields can't be exported with the "autosize" property set | ||||
Description | PDF text fields in Acrobat can have autosize set as the font size. This causes the text to dynamically resize in the field as the content is entered. Internally, this is represented as a font size of zero. My patch adds a new checkbox in Item->PDF Options->Field Properties, on the Options tab that indicates that the font size should be set to zero on export. | ||||
Steps To Reproduce | Export a PDF with a text field. Excess text entered will always overflow instead of resizing. | ||||
Tags | patch | ||||
Attached Files | pdfautotextsize.patch (4,771 bytes)
Index: scribus/annotation.h =================================================================== --- scribus/annotation.h (revision 26109) +++ scribus/annotation.h (working copy) @@ -106,7 +106,8 @@ Flag_Comb = 16777216, // Bit 25 Flag_RichText = 33554432, // Bit 26 for Textfields only Flag_RadiosInUnison = 33554432, // Bit 26 for Radio Buttons only - Flag_CommitOnSelChange = 67108864 // Bit 27 + Flag_CommitOnSelChange = 67108864, // Bit 27 + Flag_AutoTextSize = 134217728 // Bit 28 }; bool isAcroFormField() const Index: scribus/pdflib_core.cpp =================================================================== --- scribus/pdflib_core.cpp (revision 26109) +++ scribus/pdflib_core.cpp (working copy) @@ -9084,7 +9084,10 @@ cnx += UsedFontsF[ite->itemText.defaultStyle().charStyle().font().replacementName()].name; // cnx += UsedFontsP[ite->itemText.defaultStyle().charStyle().font().replacementName()] + "Form"; } - cnx += " " + FToStr(ite->itemText.defaultStyle().charStyle().fontSize() / 10.0) + " Tf"; + if (ite->annotation().Flag() & Annotation::Flag_AutoTextSize) + cnx += " " + FToStr(0) + " Tf"; + else + cnx += " " + FToStr(ite->itemText.defaultStyle().charStyle().fontSize() / 10.0) + " Tf"; if (ite->itemText.defaultStyle().charStyle().fillColor() != CommonStrings::None) cnx += " " + putColor(ite->itemText.defaultStyle().charStyle().fillColor(), ite->itemText.defaultStyle().charStyle().fillShade(), true); if (ite->fillColor() != CommonStrings::None) Index: scribus/plugins/import/pdf/slaoutput.cpp =================================================================== --- scribus/plugins/import/pdf/slaoutput.cpp (revision 26109) +++ scribus/plugins/import/pdf/slaoutput.cpp (working copy) @@ -771,6 +771,7 @@ applyTextStyle(ite, fontName, currTextColor, fontSize); ite->annotation().addToFlag(Annotation::Flag_PushButton); const auto *btn = (FormWidgetButton*) fm; + if (!btn->isReadOnly()) ite->annotation().addToFlag(Annotation::Flag_Edit); handleActions(ite, ano); @@ -777,7 +778,7 @@ } else if (wtyp == Annotation::Textfield) { - const auto *btn = (FormWidgetText*) fm; + auto *btn = (FormWidgetText*) fm; if (btn) { ite->itemText.insertChars(UnicodeParsedString(btn->getContent())); @@ -798,6 +799,8 @@ ite->annotation().setMaxChar(-1); if (!btn->isReadOnly()) ite->annotation().addToFlag(Annotation::Flag_Edit); + if (btn->getTextFontSize() == 0) + ite->annotation().addToFlag(Annotation::Flag_AutoTextSize); handleActions(ite, ano); } } Index: scribus/ui/annot.cpp =================================================================== --- scribus/ui/annot.cpp (revision 26109) +++ scribus/ui/annot.cpp (working copy) @@ -187,6 +187,7 @@ MaxChars->setEnabled(setter); NoScroll->setChecked(m_annotation.Flag() & Annotation::Flag_DoNotScroll); NoSpell->setChecked(m_annotation.Flag() & Annotation::Flag_DoNotSpellCheck); + AutoTextSize->setChecked(m_annotation.Flag() & Annotation::Flag_AutoTextSize); ChkStil->setCurrentIndex(m_annotation.ChkStil()); isChkd->setChecked(m_annotation.IsChk()); @@ -1137,6 +1138,8 @@ annotation.addToFlag(Annotation::Flag_DoNotSpellCheck); if (NoScroll->isChecked()) annotation.addToFlag(Annotation::Flag_DoNotScroll); + if (AutoTextSize->isChecked()) + annotation.addToFlag(Annotation::Flag_AutoTextSize); } if ((annotation.Type() == Annotation::Textfield) || (annotation.Type() == Annotation::Combobox)) { @@ -1419,6 +1422,7 @@ CanEdit->setChecked(annotation.Flag() & Annotation::Flag_Edit); NoSpell->setChecked(annotation.Flag() & Annotation::Flag_DoNotSpellCheck); NoScroll->setChecked(annotation.Flag() & Annotation::Flag_DoNotScroll); + AutoTextSize->setChecked(annotation.Flag() & Annotation::Flag_AutoTextSize); ChkStil->setCurrentIndex(annotation.ChkStil()); isChkd->setChecked(annotation.IsChk()); setter = annotation.MaxChar() != -1; Index: scribus/ui/annot.ui =================================================================== --- scribus/ui/annot.ui (revision 26109) +++ scribus/ui/annot.ui (working copy) @@ -728,6 +728,13 @@ </widget> </item> <item> + <widget class="QCheckBox" name="AutoTextSize"> + <property name="text"> + <string>Auto Text Size</string> + </property> + </widget> + </item> + <item> <spacer name="verticalSpacer_5"> <property name="orientation"> <enum>Qt::Vertical</enum> | ||||
Patch | Yes | ||||
Date Modified | Username | Field | Change |
---|---|---|---|
2024-04-14 02:13 | dmahoney | New Issue | |
2024-04-14 02:13 | dmahoney | Tag Attached: patch | |
2024-04-14 02:13 | dmahoney | File Added: pdfautotextsize.patch | |
2024-04-26 21:44 | jghali | Assigned To | => jghali |
2024-04-26 21:44 | jghali | Status | new => resolved |
2024-04-26 21:44 | jghali | Resolution | open => fixed |
2024-04-26 21:44 | jghali | Fixed in Version | => 1.6.2.svn |
2024-04-26 21:44 | jghali | Note Added: 0051119 | |
2024-09-16 20:54 | cbradney | Status | resolved => closed |