2011-06-06 63 views
1

我一直在尋找一種方法來更準確地「查看」圖片結合文本的結果。 當我創建一些形狀:圖形輸出和文本

g1 = Graphics[{White, EdgeForm[Directive[Thick, Black]] , 
    Rectangle[{0, 0}, {19, 28}], LightGray, 
    Rectangle[{1, 19}, {9, 27}], Rectangle[{10, 19}, {18, 27}], 
    Rectangle[{1, 23}, {2, 27}]}, 
    Epilog -> { 
    Inset[Text[Style["Information  Here", FontSize -> 8]], {1, 
     25}, {Center, Top}, Automatic, {0, 1}], 
    Inset[Text[Style["some more stuff", FontSize -> 8]], {2, 
     25}, {Center, Bottom}, Automatic, {0, 1}]}] 

它顯示了一個縮小版本,但文本不適合的矩形。 但是,當我將它移植到pdf中時,它適合放入矩形中。有沒有辦法更多地查看輸出 ?

enter image description here

編輯:

這裏的screenprint(與Windows截圖工具)後,我改變了環境的打印輸出。 Image after printout environment setting

在此之後我轉換G1到final1:

final1 = Show[g1, AspectRatio -> Automatic, 
    PlotRange -> {{-0.5, 19.5}, {-0.5, 28.5}}] 

這顯示了同樣的結果,然後我導出爲PDF。

Export["final1.pdf", Show[final1, ImageSize -> {20 cm, 29 cm}]] 

我打開PDF(Adobe reader 9)並縮放到40%(用於比較)。在這裏你可以看到它在雜技演員和紙上的樣子。

adobe reader at 40%

這是與Adobe在100%

Adobe 100%

正如你可以看到有明顯的差異。我甚至可以添加一行文字。

EDIT2:

Following Alexey suggestion with code: 

In[27]:= SetOptions[$FrontEndSession, 
PrintingStyleEnvironment -> "Printout"] 

In[28]:= Export["finalprintout1.pdf", 
Show[final1, ImageSize -> {20 cm, 29 cm}]] 

Out[28]= "finalprintout1.pdf" 

In[29]:= SetOptions[$FrontEndSession, 
PrintingStyleEnvironment -> "Working"] 

In[30]:= Export["finalworking.pdf", 
Show[final1, ImageSize -> {20 cm, 29 cm}]] 

Out[30]= "finalworking.pdf" 

它會導致同一個PDF文件。我沒有區別?

+0

要以更易讀的方式格式化代碼,請選擇代碼塊,然後按{}按鈕。我已經提交了一個編輯來做到這一點。 – 2011-06-06 15:36:44

+0

@克里斯沃爾頓,Thx我開始了四個空間,但沒有奏效。就像使用IExplorer添加圖片一樣。儘管使用了Chrome瀏覽器! – Lou 2011-06-06 16:22:29

+0

在Windows XP上使用Mathematica 7時,即使我導出爲PDF,文本也不適合框。 – 2011-06-06 17:38:12

回答

3

開關屏幕環境到「Printout」(菜單Format -> Screen Environment -> Printout),屏幕上的這個圖形看起來與它在導出的PDF中看起來完全一樣。不要用手調整筆記本內的圖形大小!只需增加放大倍數即可查看細節。

此行爲的原因是Export in Mathematica uses by default the "Printout" screen style environment rather than "Working" when exporting to PDF

P.S.這個問題是相關的:「How to export graphics in 「Working」 style environment rather than 「Printout」?」。還相關:「General PDF/EMF export problems and solutons」。如果您希望導出圖形,並且默認情況下顯示,請嘗試the solution suggested by Mr.Wizard

編輯

更明顯的例子:

g1 = Graphics[{White, EdgeForm[Directive[Thick, Black]], LightGray, 
    Rectangle[{1, 23}, {2, 27}]}, 
    Epilog -> {Inset[ 
    Text[Style["Information  Here", FontSize -> 50]], {1, 
     25}, {Center, Top}, Automatic, {0, 1}], 
    Inset[Text[Style["some more stuff", FontSize -> 50]], {2, 
     25}, {Center, Bottom}, Automatic, {0, 1}]}] 

嘗試和屏幕環境之間切換,你會看到其中的差別。嘗試Export以PDF和比較:

Export["C:\\1.pdf", g1] 

現在評價:

SetOptions[$FrontEndSession, PrintingStyleEnvironment -> "Working"] 

出口再次:

Export["C:\\2.pdf", g1] 

,並比較...

enter image description hereenter image description here

+0

@Alexey您可以發佈生成的圖像嗎? [Printout] :( – 2011-06-06 17:11:02

+0

@belisarius)這個問題中的圖形非常蹩腳,實際上我並沒有得到PDF,文本「符合矩形」。與放大比較300%根據屏幕環境的不同,我發現它在文本位置和大小方面沒有什麼區別,它與我在PDF中看到的內容相匹配 – 2011-06-06 17:45:14

+0

@Alexey謝謝,我認爲你說得對,我錯過了一些東西 – 2011-06-06 17:55:37