如何使用libreoffice的storeToURL设置writer_png_Export的图像质量?

时间:2018-01-15 09:29:43

标签: libreoffice

使用XStorable的接口storeToURL,我可以使用filter:writer_png_Export将文档导出为png文件。我的propertyValue是:

PropertyValue[] pngWriterPropertyValues = new PropertyValue[2];
pngWriterPropertyValues[0] = new PropertyValue();
pngWriterPropertyValues[0].Name = "Overwrite";
pngWriterPropertyValues[0].Value = new Boolean(true);
pngWriterPropertyValues[1] = new PropertyValue();
pngWriterPropertyValues[1].Name = "FilterName";
pngWriterPropertyValues[1].Value = "writer_png_Export";

问题是生成的图像模糊。是否有可以控制图像分辨率以提高其质量的属性?

1 个答案:

答案 0 :(得分:1)

找到答案:添加一个名为FilterData的属性并根据值设置。示例代码:

PropertyValue[] pngWriterPropertyValues = new PropertyValue[3];
pngWriterPropertyValues[0] = new PropertyValue();
pngWriterPropertyValues[0].Name = "Overwrite";
pngWriterPropertyValues[0].Value = new Boolean(true);
pngWriterPropertyValues[1] = new PropertyValue();
pngWriterPropertyValues[1].Name = "FilterName";
pngWriterPropertyValues[1].Value = "writer_png_Export";
PropertyValue pngFilterData[] = new PropertyValue[2];
pngFilterData[0] = new PropertyValue();
pngFilterData[0].Name = "PixelWidth";
pngFilterData[0].Value = 1654;
pngFilterData[1] = new PropertyValue();
pngFilterData[1].Name = "PixelHeight";
pngFilterData[1].Value = 2338;
pngWriterPropertyValues[2] = new PropertyValue();
pngWriterPropertyValues[2].Name = "FilterData";
pngWriterPropertyValues[2].Value = pngFilterData;